diff --git a/common/buildcraft/energy/BlockEngine.java b/common/buildcraft/energy/BlockEngine.java index 5553198b..d4242617 100644 --- a/common/buildcraft/energy/BlockEngine.java +++ b/common/buildcraft/energy/BlockEngine.java @@ -262,7 +262,7 @@ public class BlockEngine extends BlockBuildCraft implements ICustomHighlight { TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof TileEngine) { - ((TileEngine) tile).checkRedstonePower(); + ((TileEngine) tile).onNeighborUpdate(); } } diff --git a/common/buildcraft/energy/TileEngine.java b/common/buildcraft/energy/TileEngine.java index 13200097..54f20119 100644 --- a/common/buildcraft/energy/TileEngine.java +++ b/common/buildcraft/energy/TileEngine.java @@ -91,7 +91,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto protected boolean lastPower = false; protected PowerHandler powerHandler; - private boolean checkOrienation = false; + private boolean checkOrientation = false; private TileBuffer[] tileCache; @NetworkData @@ -203,6 +203,16 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto return 0; } } + + private void refreshPowerMode(TileEntity tile, ForgeDirection orientation) { + if (isPoweredTile(tile, orientation)) { + if ((tile instanceof IPipeTile) && (((IPipeTile) tile).getPipeType() != PipeType.POWER)) { + constantPower = false; + } else { + constantPower = true; + } + } + } @Override public void updateEntity() { @@ -223,21 +233,15 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto return; } - if (checkOrienation) { - checkOrienation = false; + if (checkOrientation) { + checkOrientation = false; if (!isOrientationValid()) { switchOrientation(true); } else { TileEntity tile = getTileBuffer(orientation).getTile(); - if (isPoweredTile(tile, orientation)) { - if ((tile instanceof IPipeTile) && (((IPipeTile) tile).getPipeType() != PipeType.POWER)) { - constantPower = false; - } else { - constantPower = true; - } - } + refreshPowerMode(tile, orientation); } } @@ -393,11 +397,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto TileEntity tile = getTileBuffer(o).getTile(); if ((!pipesOnly || tile instanceof IPipeTile) && isPoweredTile(tile, o)) { - if ((tile instanceof IPipeTile) && (((IPipeTile) tile).getPipeType() != PipeType.POWER)) { - constantPower = false; - } else { - constantPower = true; - } + refreshPowerMode(tile, o); orientation = o; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); @@ -422,14 +422,14 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto public void invalidate() { super.invalidate(); tileCache = null; - checkOrienation = true; + checkOrientation = true; } @Override public void validate() { super.validate(); tileCache = null; - checkOrienation = true; + checkOrientation = true; } @Override @@ -598,6 +598,11 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto isRedstonePowered = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); } + public void onNeighborUpdate() { + checkRedstonePower(); + checkOrientation = true; + tileCache = null; + } // RF support @Override