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.material.Material;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.IBlockAccess;
import static gregtech.api.enums.GT_Values.W;

View file

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

View file

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