Fix generator's active state being incorrect in some situations

This commit is contained in:
modmuss50 2019-09-21 11:24:40 +01:00
parent 0a7b501511
commit 5001331577

View file

@ -77,6 +77,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
if (world.isClient) {
return;
}
discharge(1);
if (getEnergy() < getMaxPower()) {
if (burnTime > 0) {
burnTime--;
@ -85,6 +86,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
}
} else {
isBurning = false;
updateState();
}
if (burnTime == 0) {
@ -113,8 +115,9 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
final BlockState BlockStateContainer = world.getBlockState(pos);
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != burnTime > 0) {
blockMachineBase.setActive(burnTime > 0, world, pos);
boolean active = burnTime > 0 && getEnergy() < getMaxPower();
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != active) {
blockMachineBase.setActive(active, world, pos);
}
}
}