From d30c251b8fa73f54f88f6c3ea527e4959bec034a Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 19 Jun 2015 18:13:05 +0100 Subject: [PATCH] fixes #40 --- .../java/techreborn/client/SlotFluid.java | 21 +++++++++++++++++++ .../container/ContainerQuantumTank.java | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/main/java/techreborn/client/SlotFluid.java diff --git a/src/main/java/techreborn/client/SlotFluid.java b/src/main/java/techreborn/client/SlotFluid.java new file mode 100644 index 000000000..1018a0a7c --- /dev/null +++ b/src/main/java/techreborn/client/SlotFluid.java @@ -0,0 +1,21 @@ +package techreborn.client; + + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.IFluidContainerItem; + +public class SlotFluid extends Slot { + public SlotFluid(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { + super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_); + } + + @Override + public boolean isItemValid(ItemStack stack) { + + return FluidContainerRegistry.isContainer(stack) || (stack != null && stack.getItem() instanceof IFluidContainerItem); + + } +} diff --git a/src/main/java/techreborn/client/container/ContainerQuantumTank.java b/src/main/java/techreborn/client/container/ContainerQuantumTank.java index 6a2851563..21afa7bf2 100644 --- a/src/main/java/techreborn/client/container/ContainerQuantumTank.java +++ b/src/main/java/techreborn/client/container/ContainerQuantumTank.java @@ -3,6 +3,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import techreborn.client.SlotFake; +import techreborn.client.SlotFluid; import techreborn.client.SlotOutput; import techreborn.tiles.TileQuantumTank; @@ -17,7 +18,7 @@ public class ContainerQuantumTank extends TechRebornContainer { this.tileQuantumTank = tileQuantumTank; this.player = player; - this.addSlotToContainer(new Slot(tileQuantumTank.inventory, 0, 80, 17)); + this.addSlotToContainer(new SlotFluid(tileQuantumTank.inventory, 0, 80, 17)); this.addSlotToContainer(new SlotOutput(tileQuantumTank.inventory, 1, 80, 53)); this.addSlotToContainer(new SlotFake(tileQuantumTank.inventory, 2, 59,