commit
248b88e8bc
1 changed files with 10 additions and 4 deletions
|
@ -24,26 +24,32 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehavior {
|
||||||
if ((aTileEntity instanceof IFluidHandler)) {
|
if ((aTileEntity instanceof IFluidHandler)) {
|
||||||
IFluidHandler tTank1;
|
IFluidHandler tTank1;
|
||||||
IFluidHandler tTank2;
|
IFluidHandler tTank2;
|
||||||
|
ForgeDirection directionFrom;
|
||||||
|
ForgeDirection directionTo;
|
||||||
if (aCoverVariable > 0) {
|
if (aCoverVariable > 0) {
|
||||||
tTank2 = aTileEntity.getITankContainerAtSide(aSide);
|
tTank2 = aTileEntity.getITankContainerAtSide(aSide);
|
||||||
tTank1 = (IFluidHandler) aTileEntity;
|
tTank1 = (IFluidHandler) aTileEntity;
|
||||||
|
directionFrom = ForgeDirection.UNKNOWN;
|
||||||
|
directionTo = ForgeDirection.getOrientation(aSide).getOpposite();
|
||||||
} else {
|
} else {
|
||||||
tTank1 = aTileEntity.getITankContainerAtSide(aSide);
|
tTank1 = aTileEntity.getITankContainerAtSide(aSide);
|
||||||
tTank2 = (IFluidHandler) aTileEntity;
|
tTank2 = (IFluidHandler) aTileEntity;
|
||||||
|
directionFrom = ForgeDirection.getOrientation(aSide).getOpposite();
|
||||||
|
directionTo = ForgeDirection.UNKNOWN;
|
||||||
}
|
}
|
||||||
if (tTank1 != null && tTank2 != null) {
|
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) {
|
if (tLiquid != null) {
|
||||||
tLiquid = tLiquid.copy();
|
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 (tLiquid.amount > 0) {
|
||||||
if (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10)) {
|
if (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10)) {
|
||||||
if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) {
|
if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) {
|
||||||
aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true);
|
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 {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue