From 45cef1b4cf46dfeb58cf0a56ce4b9825c8e6f240 Mon Sep 17 00:00:00 2001 From: Shadows_of_Fire Date: Sun, 3 Mar 2019 17:09:59 -0500 Subject: [PATCH] Closes #1210 --- .../mod/tile/TileEntityFurnaceDouble.java | 16 ++++++++++------ .../mod/tile/TileEntityGrinder.java | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java index 083c9065d..3e55daa21 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java @@ -138,15 +138,19 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements this.secondSmeltTime = 0; } - if (smelted != this.lastSmelted) { - IBlockState currState = this.world.getBlockState(this.pos); - if (currState.getValue(BlockFurnaceDouble.IS_ON) != smelted) { - this.world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, smelted)); - } + IBlockState currState = this.world.getBlockState(this.pos); + boolean current = currState.getValue(BlockFurnaceDouble.IS_ON); + boolean changeTo = current; + if (lastSmelted != smelted) changeTo = smelted; + if (this.isRedstonePowered) changeTo = true; + if (!smelted && !this.isRedstonePowered) changeTo = false; - this.lastSmelted = smelted; + if (changeTo != current) { + world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, changeTo)); } + this.lastSmelted = smelted; + if ((this.lastEnergy != this.storage.getEnergyStored() || this.lastFirstSmelt != this.firstSmeltTime || this.lastSecondSmelt != this.secondSmeltTime || this.isAutoSplit != this.lastAutoSplit) && this.sendUpdateWithInterval()) { this.lastEnergy = this.storage.getEnergyStored(); this.lastFirstSmelt = this.firstSmeltTime; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index b04b106c8..22662fec1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -132,15 +132,19 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } } - if (crushed != this.lastCrushed) { - IBlockState currState = this.world.getBlockState(this.pos); - if (currState.getValue(BlockFurnaceDouble.IS_ON) != crushed) { - this.world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, crushed)); - } + IBlockState currState = this.world.getBlockState(this.pos); + boolean current = currState.getValue(BlockFurnaceDouble.IS_ON); + boolean changeTo = current; + if (lastCrushed != crushed) changeTo = crushed; + if (this.isRedstonePowered) changeTo = true; + if (!crushed && !this.isRedstonePowered) changeTo = false; - this.lastCrushed = crushed; + if (changeTo != current) { + world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, changeTo)); } + this.lastCrushed = crushed; + if ((this.lastEnergy != this.storage.getEnergyStored() || this.lastFirstCrush != this.firstCrushTime || this.lastSecondCrush != this.secondCrushTime || this.isAutoSplit != this.lastAutoSplit) && this.sendUpdateWithInterval()) { this.lastEnergy = this.storage.getEnergyStored(); this.lastFirstCrush = this.firstCrushTime;