From 529c28649af4ab1f088c8a8c1ac758920f30652a Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sun, 20 Mar 2016 14:57:51 +0100 Subject: [PATCH] Fix item detector not working correctly --- .../gregtech/common/covers/GT_Cover_ItemMeter.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 33722e64..216877a9 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java @@ -27,17 +27,17 @@ public class GT_Cover_ItemMeter } } } + System.out.println("inventory: "+tAll+" "+tFull); tAll /= 14; - if (tAll > 0) { - aTileEntity.setOutputRedstoneSignal(aSide, aCoverVariable != 1 ? 0 : tFull > 0 ? (byte) (tFull / tAll + 1) : (byte) (15 - (tFull > 0 ? tFull / tAll + 1 : 0))); - } else { - aTileEntity.setOutputRedstoneSignal(aSide, (byte) (aCoverVariable != 1 ? 0 : 15)); - } + 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))); return aCoverVariable; } public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - aCoverVariable = (aCoverVariable + 1) % (2 + aTileEntity.getSizeInventory()); + aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % (2 + aTileEntity.getSizeInventory()); switch(aCoverVariable) { case 0: GT_Utility.sendChatToPlayer(aPlayer, "Normal"); break; case 1: GT_Utility.sendChatToPlayer(aPlayer, "Inverted"); break;