fixes in updating

This commit is contained in:
Humungus 2014-05-10 21:14:05 +02:00
parent ed6499a1fa
commit 47fe7440d5
2 changed files with 26 additions and 8 deletions

View file

@ -565,6 +565,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
pipeRemoved.put(new BlockIndex(x, y, z), pipe);
world.removeTileEntity(x, y, z);
updateNeighbourSignalState(pipe);
}
@Override
@ -860,6 +863,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
pipe.gate.dropGate();
}
pipe.resetGate();
return true;
}
return false;
@ -894,17 +898,15 @@ public class BlockGenericPipe extends BlockBuildCraft {
}
pipe.wireSet[color.ordinal()] = false;
TileBuffer neighbours[] = pipe.container.getTileCache();
pipe.updateSignalState();
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();
}
}
updateNeighbourSignalState(pipe);
if (isFullyDefined(pipe) && pipe.hasGate()) {
// pipe.gate.resolveActions();
}
pipe.container.scheduleRenderUpdate();
pipe.container.scheduleRenderUpdate();
return true;
}
@ -1329,4 +1331,17 @@ 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++) {
if (neighbours[i] != null && neighbours[i].getTile() instanceof TileGenericPipe && !neighbours[i].getTile().isInvalid()) {
((TileGenericPipe) neighbours[i].getTile()).pipe.updateSignalState();
}
}
}
}
}

View file

@ -459,6 +459,7 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
}
public void onBlockRemoval() {
if (getWorld().getWorldInfo().getGameType() != GameType.CREATIVE) {
for (ItemStack stack : computeItemDrop()) {
dropItem(stack);
@ -513,6 +514,8 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
public void resetGate() {
gate.resetGate();
gate = null;
internalUpdateScheduled = true;
container.scheduleRenderUpdate();
}