Skip to content

Commit

Permalink
Merge pull request #63 from GTNewHorizons/fix/fluidterminal-spotless-…
Browse files Browse the repository at this point in the history
…fixes

Spotless apply for branch fix/fluidterminal for #62
  • Loading branch information
GlodBlock authored Jan 17, 2023
2 parents fe1ec62 + f0aef4e commit 510cd6d
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketSwitchGuis;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;

import java.io.IOException;

public class GuiFCPriority extends AEBaseGui {

private GuiNumberBox priority;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import appeng.api.config.AccessRestriction;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiImgButton;
Expand Down Expand Up @@ -42,9 +41,9 @@ protected void addButtons() {
this.clear = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE);
this.partition = new GuiImgButton(this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH);
this.rwMode =
new GuiImgButton(this.guiLeft - 18, this.guiTop + 48, Settings.ACCESS, AccessRestriction.READ_WRITE);
this.priority = new GuiTabButton(
this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender);
new GuiImgButton(this.guiLeft - 18, this.guiTop + 48, Settings.ACCESS, AccessRestriction.READ_WRITE);
this.priority =
new GuiTabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender);

this.buttonList.add(this.priority);
this.buttonList.add(this.rwMode);
Expand All @@ -55,9 +54,12 @@ protected void addButtons() {
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(
this.getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_STORAGE_BUS)), 8, 6, GuiColors.StorageBusTitle.getColor());
this.getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_STORAGE_BUS)),
8,
6,
GuiColors.StorageBusTitle.getColor());
this.fontRendererObj.drawString(
GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, GuiColors.StorageBusInventory.getColor());
GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, GuiColors.StorageBusInventory.getColor());

if (this.rwMode != null) {
this.rwMode.set(((ContainerFluidStorageBus) this.cvb).getReadWriteMode());
Expand Down Expand Up @@ -87,5 +89,4 @@ protected void actionPerformed(final GuiButton btn) {
public void update(int id, IAEFluidStack stack) {
((ContainerFluidStorageBus) this.cvb).bus.setFluidInSlot(id, stack);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.util.Ae2Reflect;
import java.util.Iterator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;

import java.util.Iterator;

public class ContainerFluidStorageBus extends ContainerFluidConfigurable {

public final PartFluidStorageBus bus;

@GuiSync(3)
public AccessRestriction rwMode = AccessRestriction.READ_WRITE;

@GuiSync(4)
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;

Expand All @@ -45,22 +46,44 @@ protected void setupConfig() {
final IInventory config = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 9; x++) {
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(config, null, this, y * 9 + x, xo, yo, x, y, y));
this.addSlotToContainer(
new OptionalFluidSlotFakeTypeOnly(config, null, this, y * 9 + x, xo, yo, x, y, y));
}
}
this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer()))
this.addSlotToContainer((new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer((new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
1,
187,
8 + 18,
this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer()))
this.addSlotToContainer((new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
2,
187,
8 + 18 * 2,
this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer()))
this.addSlotToContainer((new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
3,
187,
8 + 18 * 3,
this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer()))
this.addSlotToContainer((new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
4,
187,
8 + 18 * 4,
this.getInventoryPlayer()))
.setNotDraggable());
}

Expand Down Expand Up @@ -89,8 +112,10 @@ public void detectAndSendChanges() {
this.verifyPermissions(SecurityPermissions.BUILD, false);

if (Platform.isServer()) {
this.setReadWriteMode((AccessRestriction) Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
this.setStorageFilter((StorageFilter) Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.STORAGE_FILTER));
this.setReadWriteMode((AccessRestriction)
Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
this.setStorageFilter((StorageFilter)
Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.STORAGE_FILTER));
}

this.standardDetectAndSendChanges();
Expand All @@ -116,8 +141,8 @@ public void partition() {
final IMEInventory<IAEFluidStack> cellInv = this.bus.getInternalHandler();
Iterator<IAEFluidStack> i = new NullIterator<>();
if (cellInv != null) {
final IItemList<IAEFluidStack> list = cellInv
.getAvailableItems(AEApi.instance().storage().createFluidList());
final IItemList<IAEFluidStack> list =
cellInv.getAvailableItems(AEApi.instance().storage().createFluidList());
i = list.iterator();
}

Expand Down Expand Up @@ -151,5 +176,4 @@ private void setReadWriteMode(final AccessRestriction rwMode) {
private void setStorageFilter(final StorageFilter storageFilter) {
this.storageFilter = storageFilter;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import javax.annotation.Nullable;

public class ItemPartFluidStorageBus extends Item implements IPartItem {

public ItemPartFluidStorageBus() {
Expand All @@ -33,16 +32,16 @@ public PartFluidStorageBus createPartFromItemStack(ItemStack is) {

@Override
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float xOffset,
float yOffset,
float zOffset) {
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float xOffset,
float yOffset,
float zOffset) {
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
}

Expand Down
Loading

0 comments on commit 510cd6d

Please sign in to comment.