fix #2199
This commit is contained in:
parent
b93b1d0d1a
commit
02839ee47a
1 changed files with 23 additions and 15 deletions
|
@ -121,13 +121,14 @@ public class PipeTransportPower extends PipeTransport {
|
|||
@Override
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
super.onNeighborBlockChange(blockId);
|
||||
updateTiles();
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
updateTile(side);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTiles() {
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
private void updateTile(ForgeDirection side) {
|
||||
TileEntity tile = container.getTile(side);
|
||||
if (container.isPipeConnected(side)) {
|
||||
if (tile != null && container.isPipeConnected(side)) {
|
||||
tiles[side.ordinal()] = tile;
|
||||
} else {
|
||||
tiles[side.ordinal()] = null;
|
||||
|
@ -136,12 +137,13 @@ public class PipeTransportPower extends PipeTransport {
|
|||
displayPower[side.ordinal()] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (needsInit) {
|
||||
needsInit = false;
|
||||
updateTiles();
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
updateTile(side);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +164,12 @@ public class PipeTransportPower extends PipeTransport {
|
|||
|
||||
init();
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (tiles[side.ordinal()].isInvalid()) {
|
||||
updateTile(side);
|
||||
}
|
||||
}
|
||||
|
||||
// Send the power to nearby pipes who requested it
|
||||
|
||||
System.arraycopy(displayPower, 0, prevDisplayPower, 0, 6);
|
||||
|
|
Loading…
Reference in a new issue