Manually reset power when stipping a wire.

Fixed style errors.
Followup on #1776
This commit is contained in:
SpaceToad 2014-05-11 16:33:09 +02:00
parent 47fe7440d5
commit aa98f263ba

View file

@ -565,9 +565,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
pipeRemoved.put(new BlockIndex(x, y, z), pipe);
world.removeTileEntity(x, y, z);
updateNeighbourSignalState(pipe);
}
@Override
@ -863,7 +863,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
pipe.gate.dropGate();
}
pipe.resetGate();
return true;
}
return false;
@ -883,7 +883,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
if (!pipe.wireSet[color.ordinal()]) {
pipe.wireSet[color.ordinal()] = true;
pipe.signalStrength[color.ordinal()] = 0;
pipe.updateSignalState();
pipe.container.scheduleRenderUpdate();
return true;
@ -896,18 +896,20 @@ public class BlockGenericPipe extends BlockBuildCraft {
if (!pipe.container.getWorldObj().isRemote) {
dropWire(color, pipe);
}
pipe.signalStrength[color.ordinal()] = 0;
pipe.wireSet[color.ordinal()] = false;
pipe.updateSignalState();
updateNeighbourSignalState(pipe);
if (isFullyDefined(pipe) && pipe.hasGate()) {
// pipe.gate.resolveActions();
pipe.gate.resolveActions();
}
pipe.container.scheduleRenderUpdate();
pipe.container.scheduleRenderUpdate();
return true;
}
return false;
@ -1331,12 +1333,12 @@ public class BlockGenericPipe extends BlockBuildCraft {
}
return super.colorMultiplier(world, x, y, z);
}
public static void updateNeighbourSignalState(Pipe pipe) {
TileBuffer neighbours[] = pipe.container.getTileCache();
if(neighbours != null) {
for(int i = 0; i < 6; i++) {
TileBuffer[] neighbours = pipe.container.getTileCache();
if (neighbours != null) {
for (int i = 0; i < 6; i++) {
if (neighbours[i] != null && neighbours[i].getTile() instanceof TileGenericPipe && !neighbours[i].getTile().isInvalid()) {
((TileGenericPipe) neighbours[i].getTile()).pipe.updateSignalState();