Extract sendDescription

This commit is contained in:
Fabian Maurer committed 2026-09-20 22:42:08 +02:00
1 parent 2e683823a3
commit 2252aa49cb
1 file changed
+17 -9
@@ -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)
}