Fix item detector not working correctly

This commit is contained in:
Blood-Asp 2016-03-20 14:57:51 +01:00
parent 29b387fbce
commit 529c28649a

View file

@ -27,17 +27,17 @@ public class GT_Cover_ItemMeter
} }
} }
} }
System.out.println("inventory: "+tAll+" "+tFull);
tAll /= 14; tAll /= 14;
if (tAll > 0) { if(tAll > 0)
aTileEntity.setOutputRedstoneSignal(aSide, aCoverVariable != 1 ? 0 : tFull > 0 ? (byte) (tFull / tAll + 1) : (byte) (15 - (tFull > 0 ? tFull / tAll + 1 : 0))); aTileEntity.setOutputRedstoneSignal(aSide, aCoverVariable == 1 ? (byte)(15 - (tFull <= 0 ? 0 : tFull / tAll + 1)) : tFull <= 0 ? 0 : (byte)(tFull / tAll + 1));
} else { else
aTileEntity.setOutputRedstoneSignal(aSide, (byte) (aCoverVariable != 1 ? 0 : 15)); aTileEntity.setOutputRedstoneSignal(aSide, ((byte)(aCoverVariable == 1 ? 15 : 0)));
}
return aCoverVariable; return aCoverVariable;
} }
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { 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) { switch(aCoverVariable) {
case 0: GT_Utility.sendChatToPlayer(aPlayer, "Normal"); break; case 0: GT_Utility.sendChatToPlayer(aPlayer, "Normal"); break;
case 1: GT_Utility.sendChatToPlayer(aPlayer, "Inverted"); break; case 1: GT_Utility.sendChatToPlayer(aPlayer, "Inverted"); break;