From eeb701cb16e7255ef0c3b92449e6f67093f5b916 Mon Sep 17 00:00:00 2001 From: rwtema Date: Thu, 31 Jul 2014 20:52:52 +0100 Subject: [PATCH] Fixed ItemFluidContainer always draining the maximum amount, regardless of the amount remaining. --- .../java/net/minecraftforge/fluids/ItemFluidContainer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java b/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java index 111777d0c..2041047c3 100644 --- a/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java +++ b/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java @@ -135,10 +135,11 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem return null; } + int currentAmount = stack.amount; stack.amount = Math.min(stack.amount, maxDrain); if (doDrain) { - if (maxDrain >= capacity) + if (currentAmount == stack.amount) { container.stackTagCompound.removeTag("Fluid"); @@ -150,7 +151,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem } NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid"); - fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain); + fluidTag.setInteger("Amount", currentAmount - stack.amount); container.stackTagCompound.setTag("Fluid", fluidTag); } return stack;