diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index eaaff47f..071b5eef 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -1173,69 +1173,69 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE return mMetaTileEntity.injectRotationalEnergy(aSide, aSpeed, aEnergy); } - private boolean canMoveFluidOnSide(ForgeDirection aSide, Fluid aFluid, boolean isFill) { - if (aSide == ForgeDirection.UNKNOWN) - return true; - - if (!mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal())) - return false; - - if(isFill && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), this)) - return true; - - if (!isFill && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), this)) - return true; - - return false; - } - + private boolean canMoveFluidOnSide(ForgeDirection aSide, Fluid aFluid, boolean isFill) { + if (aSide == ForgeDirection.UNKNOWN) + return true; + + if (!mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal())) + return false; + + if(isFill && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)) + return true; + + if (!isFill && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)) + return true; + + return false; + } + @Override - public int fill(ForgeDirection aSide, FluidStack aFluidStack, boolean doFill) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true)) - return mMetaTileEntity.fill(aSide, aFluidStack, doFill); + public int fill(ForgeDirection aSide, FluidStack aFluidStack, boolean doFill) { + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true)) + return mMetaTileEntity.fill(aSide, aFluidStack, doFill); return 0; } @Override public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), false)) + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), false)) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluidStack, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false)) - return mMetaTileEntity.drain(aSide, aFluidStack, doDrain); + public FluidStack drain(ForgeDirection aSide, FluidStack aFluidStack, boolean doDrain) { + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false)) + return mMetaTileEntity.drain(aSide, aFluidStack, doDrain); return null; } @Override public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluid, true)) + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluid, true)) return mMetaTileEntity.canFill(aSide, aFluid); return false; } @Override public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluid, false)) + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluid, false)) return mMetaTileEntity.canDrain(aSide, aFluid); return false; } @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (canAccessData() - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) - || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) - // Doesn't need to be connected to get Tank Info -- otherwise things can't connect - ) - ) + if (canAccessData() + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) + || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) + // Doesn't need to be connected to get Tank Info -- otherwise things can't connect + ) + ) return mMetaTileEntity.getTankInfo(aSide); return new FluidTankInfo[]{}; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java index 2d271ffc..b0666d23 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java @@ -64,13 +64,13 @@ public class GT_Cover_Fluidfilter if(aFluid==null){return true;} int aFilterMode = aCoverVariable & 7; int aFilterFluid = aCoverVariable >>> 3; - return aFluid.getID() == aFilterFluid ? (aFilterMode == 0 || aFilterMode == 2 ? true : false) : (aFilterMode == 1 || aFilterMode == 3 ? true : false); + return aFluid.getID() == aFilterFluid ? aFilterMode == 0 || aFilterMode == 2 : aFilterMode == 1 || aFilterMode == 3; } @Override public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { int aFilterMode = aCoverVariable & 7; - return aFilterMode == 0 || aFilterMode == 1 ? false : true; + return aFilterMode != 0 && aFilterMode != 1; } public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {