mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-26 06:53:06 +00:00
Extract sendDescription
This commit is contained in:
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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user