diff options
| author | Raven Szewczyk <git@eigenraven.me> | 2022-08-27 10:19:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-27 11:19:57 +0200 |
| commit | 6f31720697bcc351421a4d86ba3bf749375dd12c (patch) | |
| tree | 3adf8f318f22c892d74cd7c9d30b6dd3f11f11bd /src/main/java/gregtech/api/gui | |
| parent | c3eac50decd33ee2be8703dfb2ecf9cdc31c2b67 (diff) | |
| download | GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.gz GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.bz2 GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.zip | |
Update buildscript & apply spotless (#1306)
* Update dependencies
* Update buildscript, apply spotless
Diffstat (limited to 'src/main/java/gregtech/api/gui')
37 files changed, 1159 insertions, 1056 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java index 843d34c1f3..b5aebf87f2 100644 --- a/src/main/java/gregtech/api/gui/GT_Container.java +++ b/src/main/java/gregtech/api/gui/GT_Container.java @@ -4,6 +4,7 @@ import gregtech.api.interfaces.IFluidAccess; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -14,8 +15,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import java.util.List; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -109,8 +108,10 @@ public class GT_Container extends Container { if (aSlotIndex >= 0) { if (inventorySlots.get(aSlotIndex) == null || inventorySlots.get(aSlotIndex) instanceof GT_Slot_Holo) return null; - if (!(inventorySlots.get(aSlotIndex) instanceof GT_Slot_Armor)) if (aSlotIndex < getAllSlotCount()) - if (aSlotIndex < getSlotStartIndex() || aSlotIndex >= getSlotStartIndex() + getSlotCount()) return null; + if (!(inventorySlots.get(aSlotIndex) instanceof GT_Slot_Armor)) + if (aSlotIndex < getAllSlotCount()) + if (aSlotIndex < getSlotStartIndex() || aSlotIndex >= getSlotStartIndex() + getSlotCount()) + return null; } try { @@ -137,7 +138,8 @@ public class GT_Container extends Container { aPlayerInventory.setItemStack(null); } if (aMouseclick == 1) { - aPlayer.dropPlayerItemWithRandomChoice(aPlayerInventory.getItemStack().splitStack(1), true); + aPlayer.dropPlayerItemWithRandomChoice( + aPlayerInventory.getItemStack().splitStack(1), true); if (aPlayerInventory.getItemStack().stackSize == 0) { aPlayerInventory.setItemStack(null); } @@ -187,7 +189,9 @@ public class GT_Container extends Container { } aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack()); } else if (aSlot.isItemValid(mouseStack)) { - if (tTempStack.getItem() == mouseStack.getItem() && tTempStack.getItemDamage() == mouseStack.getItemDamage() && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { + if (tTempStack.getItem() == mouseStack.getItem() + && tTempStack.getItemDamage() == mouseStack.getItemDamage() + && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { tTempStackSize = aMouseclick == 0 ? mouseStack.stackSize : 1; if (tTempStackSize > aSlot.getSlotStackLimit() - tTempStack.stackSize) { tTempStackSize = aSlot.getSlotStackLimit() - tTempStack.stackSize; @@ -204,10 +208,15 @@ public class GT_Container extends Container { aSlot.putStack(mouseStack); aPlayerInventory.setItemStack(tTempStack); } - } else if (tTempStack.getItem() == mouseStack.getItem() && mouseStack.getMaxStackSize() > 1 && (!tTempStack.getHasSubtypes() || tTempStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { + } else if (tTempStack.getItem() == mouseStack.getItem() + && mouseStack.getMaxStackSize() > 1 + && (!tTempStack.getHasSubtypes() + || tTempStack.getItemDamage() == mouseStack.getItemDamage()) + && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { tTempStackSize = tTempStack.stackSize; - if (tTempStackSize > 0 && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { + if (tTempStackSize > 0 + && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { mouseStack.stackSize += tTempStackSize; tTempStack = aSlot.decrStackSize(tTempStackSize); @@ -231,7 +240,8 @@ public class GT_Container extends Container { if (aSlot.canTakeStack(aPlayer)) { // get the stack at the specified hotbar slot. tTempStack = aPlayerInventory.getStackInSlot(aMouseclick); - boolean canSwap = tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); + boolean canSwap = + tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); tTempStackSize = -1; if (!canSwap) { @@ -260,7 +270,10 @@ public class GT_Container extends Container { aSlot.putStack(tTempStack); } } - } else if (aShifthold == 3 && aPlayer.capabilities.isCreativeMode && aPlayerInventory.getItemStack() == null && aSlotIndex >= 0) { + } else if (aShifthold == 3 + && aPlayer.capabilities.isCreativeMode + && aPlayerInventory.getItemStack() == null + && aSlotIndex >= 0) { aSlot = (Slot) this.inventorySlots.get(aSlotIndex); if (aSlot != null && aSlot.getHasStack()) { tTempStack = GT_Utility.copyOrNull(aSlot.getStack()); @@ -278,19 +291,26 @@ public class GT_Container extends Container { mTileEntity.markDirty(); - //null checks and checks if the item can be stacked (maxStackSize > 1) - if (getSlotCount() > 0 && slotObject != null && slotObject.getHasStack() && !(slotObject instanceof GT_Slot_Holo)) { + // null checks and checks if the item can be stacked (maxStackSize > 1) + if (getSlotCount() > 0 + && slotObject != null + && slotObject.getHasStack() + && !(slotObject instanceof GT_Slot_Holo)) { ItemStack stackInSlot = slotObject.getStack(); stack = GT_Utility.copyOrNull(stackInSlot); - //TileEntity -> Player + // TileEntity -> Player if (aSlotIndex < getAllSlotCount()) { if (doesBindPlayerInventory()) if (!mergeItemStack(stackInSlot, getAllSlotCount(), getAllSlotCount() + 36, true)) { return null; } - //Player -> TileEntity - } else if (!mergeItemStack(stackInSlot, getShiftClickStartIndex(), getShiftClickStartIndex() + getShiftClickSlotCount(), false)) { + // Player -> TileEntity + } else if (!mergeItemStack( + stackInSlot, + getShiftClickStartIndex(), + getShiftClickStartIndex() + getShiftClickSlotCount(), + false)) { return null; } @@ -321,10 +341,17 @@ public class GT_Container extends Container { ItemStack itemStack; if (aStack.isStackable()) { - while (aStack.stackSize > 0 && (!reverseOrder && slotIndex < aSlotCount || reverseOrder && slotIndex >= aStartIndex)) { + while (aStack.stackSize > 0 + && (!reverseOrder && slotIndex < aSlotCount || reverseOrder && slotIndex >= aStartIndex)) { slot = (Slot) this.inventorySlots.get(slotIndex); itemStack = slot.getStack(); - if (!(slot instanceof GT_Slot_Holo) && !(slot instanceof GT_Slot_Output) && slot.isItemValid(aStack) && itemStack != null && itemStack.getItem() == aStack.getItem() && (!aStack.getHasSubtypes() || aStack.getItemDamage() == itemStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(aStack, itemStack)) { + if (!(slot instanceof GT_Slot_Holo) + && !(slot instanceof GT_Slot_Output) + && slot.isItemValid(aStack) + && itemStack != null + && itemStack.getItem() == aStack.getItem() + && (!aStack.getHasSubtypes() || aStack.getItemDamage() == itemStack.getItemDamage()) + && ItemStack.areItemStackTagsEqual(aStack, itemStack)) { int combinedStackSize = itemStack.stackSize + aStack.stackSize; if (itemStack.stackSize < mTileEntity.getInventoryStackLimit()) { if (combinedStackSize <= aStack.getMaxStackSize()) { @@ -569,14 +596,18 @@ public class GT_Container extends Container { return true; } - protected static ItemStack handleFluidSlotClick(IFluidAccess aFluidAccess, EntityPlayer aPlayer, boolean aProcessFullStack, boolean aCanDrain, boolean aCanFill) { + protected static ItemStack handleFluidSlotClick( + IFluidAccess aFluidAccess, + EntityPlayer aPlayer, + boolean aProcessFullStack, + boolean aCanDrain, + boolean aCanFill) { ItemStack tStackHeld = aPlayer.inventory.getItemStack(); ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld); if (tStackSizedOne == null || tStackHeld.stackSize == 0) return null; FluidStack tInputFluid = aFluidAccess.get(); FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackSizedOne, true); - if (tFluidHeld != null && tFluidHeld.amount <= 0) - tFluidHeld = null; + if (tFluidHeld != null && tFluidHeld.amount <= 0) tFluidHeld = null; if (tInputFluid == null) { // tank empty, consider fill only from now on if (!aCanFill) @@ -639,19 +670,17 @@ public class GT_Container extends Container { } replaceCursorItemStack(aPlayer, tFilledContainer); } - if (tTankStack.amount <= 0) - aFluidAccess.set(null); + if (tTankStack.amount <= 0) aFluidAccess.set(null); return tFilledContainer; } - protected static ItemStack fillFluid(IFluidAccess aFluidAccess, EntityPlayer aPlayer, FluidStack aFluidHeld, boolean aProcessFullStack) { + protected static ItemStack fillFluid( + IFluidAccess aFluidAccess, EntityPlayer aPlayer, FluidStack aFluidHeld, boolean aProcessFullStack) { // we are not using aMachine.fill() here any more, so we need to check for fluid type here ourselves - if (aFluidAccess.get() != null && !aFluidAccess.get().isFluidEqual(aFluidHeld)) - return null; + if (aFluidAccess.get() != null && !aFluidAccess.get().isFluidEqual(aFluidHeld)) return null; ItemStack tStackHeld = aPlayer.inventory.getItemStack(); ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld); - if (tStackSizedOne == null) - return null; + if (tStackSizedOne == null) return null; int tFreeSpace = aFluidAccess.getCapacity() - (aFluidAccess.get() != null ? aFluidAccess.get().amount : 0); if (tFreeSpace <= 0) @@ -715,5 +744,4 @@ public class GT_Container extends Container { GT_Utility.addItemToPlayerInventory(aPlayer, tStackResult); } } - } diff --git a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java index 97ee1d85a3..f2774bbd38 100644 --- a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java @@ -1,13 +1,12 @@ package gregtech.api.gui; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IConfigurationCircuitSupport; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; @@ -31,8 +30,7 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { mInput = 0, mID = 0, mDisplayErrorCode = 0; - public long mEnergyLong = 0, - mStorageLong = 0; + public long mEnergyLong = 0, mStorageLong = 0; private int oActive = 0, oMaxProgressTime = 0, oProgressTime = 0, @@ -44,12 +42,10 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { oInput = 0, oID = 0, oDisplayErrorCode = 0; - private long oEnergyLong = 0, - oStorageLong = 0; + private long oEnergyLong = 0, oStorageLong = 0; protected int mTimer = 0; protected Runnable circuitSlotClickCallback; - public GT_ContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); @@ -57,31 +53,32 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { addSlots(aInventoryPlayer); - if (doesBindPlayerInventory()) - bindPlayerInventory(aInventoryPlayer); + if (doesBindPlayerInventory()) bindPlayerInventory(aInventoryPlayer); detectAndSendChanges(); } else { aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; } } - public GT_ContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { + public GT_ContainerMetaTile_Machine( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { super(aInventoryPlayer, aTileEntity); mTileEntity = aTileEntity; if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { addSlots(aInventoryPlayer); - if (doesBindPlayerInventory() && doesBindInventory) - bindPlayerInventory(aInventoryPlayer); + if (doesBindPlayerInventory() && doesBindInventory) bindPlayerInventory(aInventoryPlayer); detectAndSendChanges(); } else { aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; } } + protected void addCircuitSlot() { if (mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport)mTileEntity.getMetaTileEntity(); - GT_Slot_Render slotCircuit = new GT_Slot_Render(mTileEntity, ccs.getCircuitSlot(), ccs.getCircuitSlotX(), ccs.getCircuitSlotY()); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mTileEntity.getMetaTileEntity(); + GT_Slot_Render slotCircuit = + new GT_Slot_Render(mTileEntity, ccs.getCircuitSlot(), ccs.getCircuitSlotX(), ccs.getCircuitSlotY()); addSlotToContainer(slotCircuit); slotCircuit.setEnabled(ccs.allowSelectCircuit()); } @@ -95,8 +92,7 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) - return; + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; mStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getEUCapacity()); mStorageLong = mTileEntity.getEUCapacity(); mEnergy = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredEU()); @@ -261,17 +257,17 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { public void setCircuitSlotClickCallback(Runnable circuitSlotClickCallback) { this.circuitSlotClickCallback = circuitSlotClickCallback; } + @Override public ItemStack slotClick(int aSlotNumber, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { if (mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { IMetaTileEntity machine = mTileEntity.getMetaTileEntity(); - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport)machine; + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) machine; if (ccs.allowSelectCircuit() && aSlotNumber == ccs.getCircuitGUISlot() && aMouseclick < 2) { ItemStack newCircuit; if (aShifthold == 1) { if (aMouseclick == 0) { - if (circuitSlotClickCallback != null) - circuitSlotClickCallback.run(); + if (circuitSlotClickCallback != null) circuitSlotClickCallback.run(); return null; } else { // clear @@ -282,7 +278,9 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { List<ItemStack> tCircuits = ccs.getConfigurationCircuits(); int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack); if (index < 0) { - int curIndex = GT_Utility.findMatchingStackInList(tCircuits, machine.getStackInSlot(ccs.getCircuitSlot())) + 1; + int curIndex = GT_Utility.findMatchingStackInList( + tCircuits, machine.getStackInSlot(ccs.getCircuitSlot())) + + 1; if (aMouseclick == 0) { curIndex += 1; } else { diff --git a/src/main/java/gregtech/api/gui/GT_Container_2by2_Fluid.java b/src/main/java/gregtech/api/gui/GT_Container_2by2_Fluid.java index f8f4e3c886..35ed089c97 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_2by2_Fluid.java +++ b/src/main/java/gregtech/api/gui/GT_Container_2by2_Fluid.java @@ -38,15 +38,18 @@ public class GT_Container_2by2_Fluid extends GT_ContainerMetaTile_Machine { * I'd imagine this lag to become only more severe when playing MP over ethernet, which would have much more latency * than a memory connection */ - GT_MetaTileEntity_Hatch_MultiInput tTank = (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); + GT_MetaTileEntity_Hatch_MultiInput tTank = + (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); tTank.setDrainableStack(GT_Utility.getFluidFromDisplayStack(tTank.getStackInSlot(2))); } - GT_MetaTileEntity_Hatch_MultiInput tTank = (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); + GT_MetaTileEntity_Hatch_MultiInput tTank = + (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); MultiFluidAccess tDrainableAccess = MultiFluidAccess.from(tTank, aSlotIndex); ItemStack tStackHeld = aPlayer.inventory.getItemStack(); FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true); if (tDrainableAccess.isMatch(tFluidHeld, aSlotIndex)) - return handleFluidSlotClick(tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); + return handleFluidSlotClick( + tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java index 6db6d45a89..fc0b3270d2 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java @@ -1,23 +1,20 @@ package gregtech.api.gui; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.IFluidAccess; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import java.util.List; - -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -25,10 +22,7 @@ import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Basi */ public class GT_Container_BasicMachine extends GT_Container_BasicTank { - public boolean - mFluidTransfer = false, - mItemTransfer = false, - mStuttering = false; + public boolean mFluidTransfer = false, mItemTransfer = false, mStuttering = false; GT_Slot_Holo slotFluidTransferToggle; GT_Slot_Holo slotItemTransferToggle; @@ -198,9 +192,7 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { addSlotToContainer(slotBattery = new Slot(mTileEntity, 1, 80, 63)); addSlotToContainer(slotSpecial = new Slot(mTileEntity, 3, 125, 63)); addSlotToContainer(slotFluidInput = new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 63)); - slotFluidInput.setEnabled(recipes != null - ? (recipes.hasFluidInputs()) - : (machine.getCapacity() != 0)); + slotFluidInput.setEnabled(recipes != null ? (recipes.hasFluidInputs()) : (machine.getCapacity() != 0)); } @Override @@ -220,19 +212,25 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { } return null; default: - if (aSlotNumber == OTHER_SLOT_COUNT + 1 + machine.mInputSlotCount + machine.mOutputItems.length && aMouseclick < 2) { + if (aSlotNumber == OTHER_SLOT_COUNT + 1 + machine.mInputSlotCount + machine.mOutputItems.length + && aMouseclick < 2) { if (mTileEntity.isClientSide()) { // see parent class slotClick for an explanation on why doing this - GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); + GT_MetaTileEntity_BasicTank tTank = + (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); tTank.setFillableStack(GT_Utility.getFluidFromDisplayStack(tTank.getStackInSlot(2))); } GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); BasicTankFluidAccess tFillableAccess = BasicTankFluidAccess.from(tTank, true); GT_Recipe_Map recipes = machine.getRecipeList(); - //If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. - ItemStack tToken = handleFluidSlotClick(tFillableAccess, aPlayer, aMouseclick == 0, true, (recipes == null || recipes.hasFluidInputs())); - if (mTileEntity.isServerSide() && tToken != null) - mTileEntity.markInventoryBeenModified(); + // If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. + ItemStack tToken = handleFluidSlotClick( + tFillableAccess, + aPlayer, + aMouseclick == 0, + true, + (recipes == null || recipes.hasFluidInputs())); + if (mTileEntity.isServerSide() && tToken != null) mTileEntity.markInventoryBeenModified(); return tToken; } else { return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java index d294b60ca9..23769ab0cc 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java @@ -55,7 +55,8 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { } GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); BasicTankFluidAccess tDrainableAccess = BasicTankFluidAccess.from(tTank, false); - return handleFluidSlotClick(tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); + return handleFluidSlotClick( + tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } @@ -66,8 +67,7 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; if (((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid != null) mContent = ((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid.amount; - else - mContent = 0; + else mContent = 0; for (Object crafter : this.crafters) { ICrafting player = (ICrafting) crafter; if (mTimer % 500 == 0 || oContent != mContent) { @@ -114,10 +114,8 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { @Override public void set(FluidStack stack) { - if (mIsFillableStack) - mTank.setFillableStack(stack); - else - mTank.setDrainableStack(stack); + if (mIsFillableStack) mTank.setFillableStack(stack); + else mTank.setDrainableStack(stack); } @Override diff --git a/src/ |
