diff options
| author | Technus <daniel112092@gmail.com> | 2016-11-25 13:04:44 +0100 |
|---|---|---|
| committer | Technus <daniel112092@gmail.com> | 2016-11-25 13:04:44 +0100 |
| commit | ee64bac739e3b693e0868dd1967fc82b51997b6c (patch) | |
| tree | 9f2428730f04b3736ffb37d052dcf81607b92049 /src/main/java/gregtech/common/covers | |
| parent | bc451d2cbfdd724fb77efc6db95aa1355495842a (diff) | |
| download | GT5-Unofficial-ee64bac739e3b693e0868dd1967fc82b51997b6c.tar.gz GT5-Unofficial-ee64bac739e3b693e0868dd1967fc82b51997b6c.tar.bz2 GT5-Unofficial-ee64bac739e3b693e0868dd1967fc82b51997b6c.zip | |
Cover name changes and fix for item detector cover
Diffstat (limited to 'src/main/java/gregtech/common/covers')
| -rw-r--r-- | src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java index b1f92da27b..6ce034e9b4 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java @@ -16,22 +16,22 @@ public class GT_Cover_ItemMeter } else { tSlots = new int[]{aCoverVariable - 2}; } - int tAll = 0; - int tFull = 0; + int tMax = 0; + int tUsed = 0; for (int i : tSlots) { - if ((i > 0) && (i < aTileEntity.getSizeInventory())) { - tAll += 64; + if (i >= 0 && i < aTileEntity.getSizeInventory()) { + tMax+=64; ItemStack tStack = aTileEntity.getStackInSlot(i); - if (tStack != null) { - tFull += tStack.stackSize * 64 / tStack.getMaxStackSize(); - } + if (tStack != null) + tUsed += (tStack.stackSize<<6)/tStack.getMaxStackSize(); } } - tAll /= 14; - if(tAll > 0) - aTileEntity.setOutputRedstoneSignal(aSide, aCoverVariable == 1 ? (byte)(15 - (tFull <= 0 ? 0 : tFull / tAll + 1)) : tFull <= 0 ? 0 : (byte)(tFull / tAll + 1)); - else - aTileEntity.setOutputRedstoneSignal(aSide, ((byte)(aCoverVariable == 1 ? 15 : 0))); + if(tUsed==0)//nothing + aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 15 : 0)); + 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)) ); return aCoverVariable; } |
