diff --git a/codechicken/multipart/MultipartGenerator.scala b/codechicken/multipart/MultipartGenerator.scala index 7f736dc..2c40a5c 100644 --- a/codechicken/multipart/MultipartGenerator.scala +++ b/codechicken/multipart/MultipartGenerator.scala @@ -76,7 +76,7 @@ object MultipartGenerator { ntile.partList(0).invalidateConvertedTile() world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block.blockID, 0, 0) - world.setBlockTileEntity(pos.x, pos.y, pos.z, ntile) + silentAddTile(world, pos, ntile) PacketCustom.sendToChunk(new Packet53BlockChange(pos.x, pos.y, pos.z, world), world, pos.x>>4, pos.z>>4) ntile.partList(0).onConverted() ntile.writeAddPart(ntile.partList(0)) @@ -88,7 +88,7 @@ object MultipartGenerator { ntile = factory.generateTile(partTraits++tileTraits, world.isRemote) tile.setValid(false) - world.setBlockTileEntity(pos.x, pos.y, pos.z, ntile) + silentAddTile(world, pos, ntile) ntile.from(tile) } } @@ -96,12 +96,22 @@ object MultipartGenerator { world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block.blockID, 0, 0) ntile = factory.generateTile(partTraits, world.isRemote) - world.setBlockTileEntity(pos.x, pos.y, pos.z, ntile) + silentAddTile(world, pos, ntile) } ntile.addPart_impl(part) return ntile } + /** + * Adds a tile entity to the world without notifying neighbor blocks or adding it to the tick list + */ + def silentAddTile(world:World, pos:BlockCoord, tile:TileEntity) + { + val chunk = world.getChunkFromBlockCoords(pos.x, pos.z) + if(chunk != null) + chunk.setChunkBlockTileEntity(pos.x & 15, pos.y, pos.z & 15, tile); + } + /** * Check if tile satisfies all the interfaces required by parts. If not, return a new generated copy of tile */ diff --git a/codechicken/multipart/TileMultipart.scala b/codechicken/multipart/TileMultipart.scala index 29cf4e9..9b137c0 100644 --- a/codechicken/multipart/TileMultipart.scala +++ b/codechicken/multipart/TileMultipart.scala @@ -178,6 +178,14 @@ class TileMultipart extends TileEntity operate(p => if(!parts.contains(p)) parts.foreach(p.onPartChanged(_))) } + /** + * Notifies neighboring blocks that this tile has changed + */ + def notifyTileChange() + { + worldObj.func_96440_m(xCoord, yCoord, zCoord, 0) + } + def onNeighborBlockChange() { operate(_.onNeighborChanged()) @@ -292,6 +300,7 @@ class TileMultipart extends TileEntity part.onAdded() partAdded(part) notifyPartChange(part) + notifyTileChange() markDirty() markRender() }