Fix fluid detector cover and make casings work more like blocks...

This commit is contained in:
Technus 2016-11-25 14:53:03 +01:00
parent ee64bac739
commit 3dac87a097
4 changed files with 14 additions and 13 deletions

View file

@ -5,6 +5,7 @@ import gregtech.api.util.GT_LanguageManager;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.world.IBlockAccess;
import static gregtech.api.enums.GT_Values.W; import static gregtech.api.enums.GT_Values.W;

View file

@ -13,6 +13,6 @@ public class GT_Material_Casings
} }
public boolean isOpaque() { public boolean isOpaque() {
return false; return true;
} }
} }

View file

@ -28,7 +28,7 @@ public class GT_Cover_ItemMeter
} }
if(tUsed==0)//nothing if(tUsed==0)//nothing
aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 15 : 0)); aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 15 : 0));
else if(tUsed == tMax)//full else if(tUsed >= tMax)//full
aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 0 : 15)); aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 0 : 15));
else//1-14 range else//1-14 range
aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 14-((14*tUsed)/tMax) : 1+((14*tUsed)/tMax)) ); aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 14-((14*tUsed)/tMax) : 1+((14*tUsed)/tMax)) );

View file

@ -15,27 +15,27 @@ public class GT_Cover_LiquidMeter
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((aTileEntity instanceof IFluidHandler)) { if ((aTileEntity instanceof IFluidHandler)) {
FluidTankInfo[] tTanks = ((IFluidHandler) aTileEntity).getTankInfo(ForgeDirection.UNKNOWN); FluidTankInfo[] tTanks = ((IFluidHandler) aTileEntity).getTankInfo(ForgeDirection.UNKNOWN);
long tAll = 0L; long tMax = 0;
long tFull = 0L; long tUsed = 0;
if (tTanks != null) { if (tTanks != null) {
for (FluidTankInfo tTank : tTanks) { for (FluidTankInfo tTank : tTanks) {
if (tTank != null) { if (tTank != null) {
tAll += tTank.capacity; tMax += tTank.capacity;
FluidStack tLiquid = tTank.fluid; FluidStack tLiquid = tTank.fluid;
if (tLiquid != null) { if (tLiquid != null) {
tFull += tLiquid.amount; tUsed += tLiquid.amount;
} }
} }
} }
} }
tAll /= 14L; if(tUsed==0L)//nothing
if (tAll > 0L) { aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 0 ? 15 : 0));
aTileEntity.setOutputRedstoneSignal(aSide, aCoverVariable != 0 ? (byte) (int) (15L - (tFull <= 0L ? 0L : tFull / tAll + 1L)) : tFull <= 0L ? 0 : (byte) (int) (tFull / tAll + 1L)); else if(tUsed >= tMax)//full
} else { aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 0 ? 0 : 15));
aTileEntity.setOutputRedstoneSignal(aSide, ((byte) (aCoverVariable != 0 ? 15 : 0))); else//1-14 range
} aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 0 ? 14-((14*tUsed)/tMax) : 1+((14*tUsed)/tMax)) );
} else { } else {
aTileEntity.setOutputRedstoneSignal(aSide, (byte) 0); aTileEntity.setOutputRedstoneSignal(aSide, (byte)0);
} }
return aCoverVariable; return aCoverVariable;
} }