From be375040094368b00958da506d30e38e439350e3 Mon Sep 17 00:00:00 2001 From: Dimach Date: Sun, 11 Dec 2016 19:56:06 +0200 Subject: [PATCH] Fixed #796. --- .../common/covers/GT_Cover_FluidRegulator.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java index ff47dfdc..a8361a78 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java @@ -24,26 +24,32 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehavior { if ((aTileEntity instanceof IFluidHandler)) { IFluidHandler tTank1; IFluidHandler tTank2; + ForgeDirection directionFrom; + ForgeDirection directionTo; if (aCoverVariable > 0) { tTank2 = aTileEntity.getITankContainerAtSide(aSide); tTank1 = (IFluidHandler) aTileEntity; + directionFrom = ForgeDirection.UNKNOWN; + directionTo = ForgeDirection.getOrientation(aSide).getOpposite(); } else { tTank1 = aTileEntity.getITankContainerAtSide(aSide); tTank2 = (IFluidHandler) aTileEntity; + directionFrom = ForgeDirection.getOrientation(aSide).getOpposite(); + directionTo = ForgeDirection.UNKNOWN; } if (tTank1 != null && tTank2 != null) { - FluidStack tLiquid = tTank1.drain(ForgeDirection.UNKNOWN, Math.abs(aCoverVariable), false); + FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aCoverVariable), false); if (tLiquid != null) { tLiquid = tLiquid.copy(); - tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid, false); + tLiquid.amount = tTank2.fill(directionTo, tLiquid, false); if (tLiquid.amount > 0) { if (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10)) { if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) { aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true); - tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.UNKNOWN, tLiquid.amount, true), true); + tTank2.fill(directionTo, tTank1.drain(directionFrom, tLiquid.amount, true), true); } } else { - tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.UNKNOWN, tLiquid.amount, true), true); + tTank2.fill(directionTo, tTank1.drain(directionFrom, tLiquid.amount, true), true); } } }