Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sendChunkUpdate()
- {
- if (this.numberOfTilesToUpdate != 0)
- {
- int i;
- int j;
- int k;
- if (this.numberOfTilesToUpdate == 1)
- {
- i = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[0] >> 12 & 15);
- j = this.locationOfBlockChange[0] & 255;
- k = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[0] >> 8 & 15);
- this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(i, j, k, PlayerManager.this.theWorldServer));
- if (PlayerManager.this.theWorldServer.getBlock(i, j, k).hasTileEntity(PlayerManager.this.theWorldServer.getBlockMetadata(i, j, k)))
- {
- this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(i, j, k));
- }
- }
- else
- {
- int l;
- if (this.numberOfTilesToUpdate == net.minecraftforge.common.ForgeModContainer.clumpingThreshold)
- {
- i = this.chunkLocation.chunkXPos * 16;
- j = this.chunkLocation.chunkZPos * 16;
- this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate));
- // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones
- for (k = 0; false && k < 16; ++k)
- {
- if ((this.flagsYAreasToUpdate & 1 << k) != 0)
- {
- l = k << 4;
- List list = PlayerManager.this.theWorldServer.func_147486_a(i, l, j, i + 16, l + 16, j + 16);
- for (int i1 = 0; i1 < list.size(); ++i1)
- {
- this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(i1));
- }
- }
- }
- }
- else
- {
- this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numberOfTilesToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos)));
- }
- { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small
- WorldServer world = PlayerManager.this.theWorldServer;
- for (i = 0; i < this.numberOfTilesToUpdate; ++i)
- {
- j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15);
- k = this.locationOfBlockChange[i] & 255;
- l = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[i] >> 8 & 15);
- if (world.getBlock(j, k, l).hasTileEntity(world.getBlockMetadata(j, k, l)))
- {
- this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(j, k, l));
- }
- }
- }
- }
- this.numberOfTilesToUpdate = 0;
- this.flagsYAreasToUpdate = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement