This commit is contained in:
Adrian Siekierka 2014-11-11 11:56:09 +01:00
parent b93b1d0d1a
commit 02839ee47a

View file

@ -121,27 +121,29 @@ public class PipeTransportPower extends PipeTransport {
@Override @Override
public void onNeighborBlockChange(int blockId) { public void onNeighborBlockChange(int blockId) {
super.onNeighborBlockChange(blockId); super.onNeighborBlockChange(blockId);
updateTiles(); for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
updateTile(side);
}
} }
private void updateTiles() { private void updateTile(ForgeDirection side) {
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { TileEntity tile = container.getTile(side);
TileEntity tile = container.getTile(side); if (tile != null && container.isPipeConnected(side)) {
if (container.isPipeConnected(side)) { tiles[side.ordinal()] = tile;
tiles[side.ordinal()] = tile; } else {
} else { tiles[side.ordinal()] = null;
tiles[side.ordinal()] = null; internalPower[side.ordinal()] = 0;
internalPower[side.ordinal()] = 0; internalNextPower[side.ordinal()] = 0;
internalNextPower[side.ordinal()] = 0; displayPower[side.ordinal()] = 0;
displayPower[side.ordinal()] = 0; }
} }
}
}
private void init() { private void init() {
if (needsInit) { if (needsInit) {
needsInit = false; needsInit = false;
updateTiles(); for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
updateTile(side);
}
} }
} }
@ -162,6 +164,12 @@ public class PipeTransportPower extends PipeTransport {
init(); init();
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
if (tiles[side.ordinal()].isInvalid()) {
updateTile(side);
}
}
// Send the power to nearby pipes who requested it // Send the power to nearby pipes who requested it
System.arraycopy(displayPower, 0, prevDisplayPower, 0, 6); System.arraycopy(displayPower, 0, prevDisplayPower, 0, 6);