diff --git a/src/main/scala/codechicken/multipart/handler/packethandlers.scala b/src/main/scala/codechicken/multipart/handler/packethandlers.scala index d51d460..c56d739 100644 --- a/src/main/scala/codechicken/multipart/handler/packethandlers.scala +++ b/src/main/scala/codechicken/multipart/handler/packethandlers.scala @@ -229,20 +229,28 @@ object MultipartSPH (p, chunks) <- watchers; c <- chunks ) { - val chunk = world.getChunkFromChunkCoords(c.chunkXPos, c.chunkZPos) - val pkt = getDescPacket( - chunk, - chunk.chunkTileEntityMap - .asInstanceOf[JMap[_, TileEntity]] - .values - .iterator - ) - if (pkt != null) pkt.sendToPlayer(p) + sendDescription(world, p, c) chunkWatchers.getOrElseUpdate(world, newWatchMap).addBinding(p, c) } newWatchers.clear() } + private def sendDescription( + world: World, + p: EntityPlayerMP, + c: ChunkCoordIntPair + ) { + val chunk = world.getChunkFromChunkCoords(c.chunkXPos, c.chunkZPos) + val pkt = getDescPacket( + chunk, + chunk.chunkTileEntityMap + .asInstanceOf[JMap[_, TileEntity]] + .values + .iterator + ) + if (pkt != null) pkt.sendToPlayer(p) + } + def onChunkWatch(p: EntityPlayerMP, c: ChunkCoordIntPair) { newWatchers.getOrElseUpdate(p.worldObj, newWatchMap).addBinding(p, c) }