Fixed ItemFluidContainer always draining the maximum amount, regardless of the amount remaining.

This commit is contained in:
rwtema 2014-07-31 20:52:52 +01:00
parent bc8374d71c
commit eeb701cb16
1 changed files with 3 additions and 2 deletions

View File

@ -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;