From 491a6d6c4b54000206c87438c381e11add40499d Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sun, 19 Jun 2016 22:44:28 +0200 Subject: [PATCH] Plunger also emptys input tank after output tank is empty --- .../behaviors/Behaviour_Plunger_Fluid.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java index 4b087986..d716fde8 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java @@ -1,8 +1,12 @@ package gregtech.common.items.behaviors; import gregtech.api.GregTech_API; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; @@ -38,7 +42,18 @@ public class Behaviour_Plunger_Fluid } } } - } + + } + if (aTileEntity instanceof IGregTechTileEntity) { + IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aTileEntity; + IMetaTileEntity mTileEntity = tTileEntity.getMetaTileEntity(); + if (mTileEntity instanceof GT_MetaTileEntity_BasicTank) { + GT_MetaTileEntity_BasicTank machine = (GT_MetaTileEntity_BasicTank) mTileEntity; + if(machine.mFluid!=null&&machine.mFluid.amount>0) + machine.mFluid.amount = machine.mFluid.amount - Math.min(machine.mFluid.amount, 1000); + return true; + } + } return false; }