This commit is contained in:
Dimach 2016-12-11 19:56:06 +02:00
parent 7df5add5a9
commit be37504009

View file

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