From 427b1e105a66a354d484e34b4a4c6dd616d72e2b Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 13 May 2017 10:30:33 +0200 Subject: [PATCH] Why does one change the machine state TWICE in the same tick... --- .../generators/GT_MetaTileEntity_LightningRod.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java index 7501924f..1a0bc8a6 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java @@ -46,7 +46,12 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach World aWorld = aBaseMetaTileEntity.getWorld(); XSTR aXSTR = new XSTR(); if (!aWorld.isRemote) { - if(aBaseMetaTileEntity.getStoredEU()>0)aBaseMetaTileEntity.decreaseStoredEnergyUnits(aBaseMetaTileEntity.getStoredEU()/100+1, false); + if(aBaseMetaTileEntity.getStoredEU()>0){ + aBaseMetaTileEntity.setActive(true); + aBaseMetaTileEntity.decreaseStoredEnergyUnits(aBaseMetaTileEntity.getStoredEU()/100+1, false); + }else { + aBaseMetaTileEntity.setActive(false); + } if (aTick % 256 == 0 && (aWorld.isThundering() || (aWorld.isRaining() && aXSTR.nextInt(10) == 0))) { int aRodValue = 0; @@ -68,10 +73,8 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach } if (!aWorld.isThundering() && ((aY + aRodValue) < 128)) aRodValue = 0; if (aXSTR.nextInt(4 * aWorld.getHeight()) < (aRodValue * (aY + aRodValue))) { - aBaseMetaTileEntity.setActive(true); aBaseMetaTileEntity.increaseStoredEnergyUnits(maxEUStore() - aBaseMetaTileEntity.getStoredEU(), false); aWorld.addWeatherEffect(new EntityLightningBolt(aWorld, aX, aY + aRodValue, aZ)); - aBaseMetaTileEntity.setActive(false); } } }