Fix notifyTileChanges() loading chunks.

This commit is contained in:
Ben Spiers 2015-03-22 21:32:20 +00:00
parent c7d3b77112
commit 1fe0484cd1
3 changed files with 39 additions and 6 deletions

View file

@ -644,7 +644,7 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
{
TransporterUtils.incrementColor(this);
refreshConnections();
tile().notifyTileChange();
notifyTileChange();
PathfinderCache.onChanged(Coord4D.get(tile()));
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tile()), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tile())));
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleColor") + ": " + (color != null ? color.getName() : EnumColor.BLACK + MekanismUtils.localize("gui.none"))));

View file

@ -536,7 +536,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
onRedstoneJoin();
}
tile().notifyTileChange();
notifyTileChange();
}
}
}
@ -576,7 +576,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
redstonePowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
refreshConnections();
tile().notifyTileChange();
notifyTileChange();
}
@Override
@ -706,7 +706,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
redstoneReactive ^= true;
refreshConnections();
tile().notifyTileChange();
notifyTileChange();
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Redstone sensitivity turned " + EnumColor.INDIGO + (redstoneReactive ? "on." : "off.")));
}
@ -753,4 +753,9 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
return false;
}
public void notifyTileChange()
{
MekanismUtils.notifyLoadedNeighborsOfTileChange(world(), Coord4D.get(tile()));
}
}

View file

@ -694,6 +694,34 @@ public final class MekanismUtils
return false;
}
public static void notifyLoadedNeighborsOfTileChange(World world, Coord4D coord)
{
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
Coord4D offset = coord.getFromSide(dir);
if(offset.exists(world))
{
Block block1 = offset.getBlock(world);
block1.onNeighborChange(world, offset.xCoord, offset.yCoord, offset.zCoord, coord.xCoord, coord.yCoord, coord.zCoord);
if(block1.isNormalCube(world, offset.xCoord, offset.yCoord, offset.zCoord))
{
offset = offset.getFromSide(dir);
if(offset.exists(world))
{
block1 = offset.getBlock(world);
if(block1.getWeakChanges(world, offset.xCoord, offset.yCoord, offset.zCoord))
{
block1.onNeighborChange(world, offset.xCoord, offset.yCoord, offset.zCoord, coord.xCoord, coord.yCoord, coord.zCoord);
}
}
}
}
}
}
/**
* Places a fake bounding block at the defined location.
* @param world - world to place block in