Properly update neighbors for redstone signal changes.
This commit is contained in:
parent
51b8e73f26
commit
0488ff552a
1 changed files with 20 additions and 3 deletions
|
@ -393,6 +393,18 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
||||||
public boolean hasGate() {
|
public boolean hasGate() {
|
||||||
return gate != null;
|
return gate != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void updateNeighbors(boolean needSelf) {
|
||||||
|
if (needSelf) {
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, BuildCraftTransport.genericPipeBlock.blockID);
|
||||||
|
}
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, BuildCraftTransport.genericPipeBlock.blockID);
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord + 1, zCoord, BuildCraftTransport.genericPipeBlock.blockID);
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, BuildCraftTransport.genericPipeBlock.blockID);
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, BuildCraftTransport.genericPipeBlock.blockID);
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord - 1, BuildCraftTransport.genericPipeBlock.blockID);
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord + 1, BuildCraftTransport.genericPipeBlock.blockID);
|
||||||
|
}
|
||||||
|
|
||||||
public void onBlockRemoval() {
|
public void onBlockRemoval() {
|
||||||
if (wireSet[IPipe.WireColor.Red.ordinal()])
|
if (wireSet[IPipe.WireColor.Red.ordinal()])
|
||||||
|
@ -415,6 +427,10 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
||||||
container.dropFacade(direction);
|
container.dropFacade(direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (broadcastRedstone) {
|
||||||
|
updateNeighbors(false); // self will update due to block id changing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrigger(int position, ITrigger trigger) {
|
public void setTrigger(int position, ITrigger trigger) {
|
||||||
|
@ -474,10 +490,12 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
||||||
triggerParameters = new ITriggerParameter[triggerParameters.length];
|
triggerParameters = new ITriggerParameter[triggerParameters.length];
|
||||||
activatedActions = new Action[activatedActions.length];
|
activatedActions = new Action[activatedActions.length];
|
||||||
broadcastSignal = new boolean[] { false, false, false, false };
|
broadcastSignal = new boolean[] { false, false, false, false };
|
||||||
|
if (broadcastRedstone) {
|
||||||
|
updateNeighbors(true);
|
||||||
|
}
|
||||||
broadcastRedstone = false;
|
broadcastRedstone = false;
|
||||||
//worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
//worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||||
container.scheduleRenderUpdate();
|
container.scheduleRenderUpdate();
|
||||||
//worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, BuildCraftTransport.genericPipeBlock.blockID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolveActions() {
|
private void resolveActions() {
|
||||||
|
@ -534,8 +552,7 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
||||||
|
|
||||||
if (oldBroadcastRedstone != broadcastRedstone) {
|
if (oldBroadcastRedstone != broadcastRedstone) {
|
||||||
container.scheduleRenderUpdate();
|
container.scheduleRenderUpdate();
|
||||||
//worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
updateNeighbors(true);
|
||||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, BuildCraftTransport.genericPipeBlock.blockID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < oldBroadcastSignal.length; ++i)
|
for (int i = 0; i < oldBroadcastSignal.length; ++i)
|
||||||
|
|
Loading…
Reference in a new issue