Why does one change the machine state TWICE in the same tick...

This commit is contained in:
Technus 2017-05-13 10:30:33 +02:00 committed by Blood-Asp
parent 9a69e1978d
commit 427b1e105a

View file

@ -46,7 +46,12 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach
World aWorld = aBaseMetaTileEntity.getWorld(); World aWorld = aBaseMetaTileEntity.getWorld();
XSTR aXSTR = new XSTR(); XSTR aXSTR = new XSTR();
if (!aWorld.isRemote) { 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))) { if (aTick % 256 == 0 && (aWorld.isThundering() || (aWorld.isRaining() && aXSTR.nextInt(10) == 0))) {
int aRodValue = 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 (!aWorld.isThundering() && ((aY + aRodValue) < 128)) aRodValue = 0;
if (aXSTR.nextInt(4 * aWorld.getHeight()) < (aRodValue * (aY + aRodValue))) { if (aXSTR.nextInt(4 * aWorld.getHeight()) < (aRodValue * (aY + aRodValue))) {
aBaseMetaTileEntity.setActive(true);
aBaseMetaTileEntity.increaseStoredEnergyUnits(maxEUStore() - aBaseMetaTileEntity.getStoredEU(), false); aBaseMetaTileEntity.increaseStoredEnergyUnits(maxEUStore() - aBaseMetaTileEntity.getStoredEU(), false);
aWorld.addWeatherEffect(new EntityLightningBolt(aWorld, aX, aY + aRodValue, aZ)); aWorld.addWeatherEffect(new EntityLightningBolt(aWorld, aX, aY + aRodValue, aZ));
aBaseMetaTileEntity.setActive(false);
} }
} }
} }