From 2252aa49cb8b4fdd48115c0d0421b965a37d6e7f Mon Sep 17 00:00:00 2001 From: Fabian Maurer Date: Sun, 20 Sep 2026 22:42:08 +0200 Subject: [PATCH] Extract sendDescription --- .../multipart/handler/packethandlers.scala | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) 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) }