/** * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends * S21PacketChunkData */ public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); for (S22PacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : packetIn.getChangedBlocks()) { this.clientWorldController.invalidateRegionAndSetBlock(s22packetmultiblockchange$blockupdatedata.getPos(), s22packetmultiblockchange$blockupdatedata.getBlockState()); } }
/** * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk * are changed. If only one block requires an update, the server sends * S23PacketBlockChange and if 64 or more blocks are changed, the server sends * S21PacketChunkData */ public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); for (S22PacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : packetIn .getChangedBlocks()) { this.clientWorldController.invalidateRegionAndSetBlock(s22packetmultiblockchange$blockupdatedata.getPos(), s22packetmultiblockchange$blockupdatedata.getBlockState()); } }
/** * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends * S21PacketChunkData */ public void handleMultiBlockChange(S22PacketMultiBlockChange p_147287_1_) { int var2 = p_147287_1_.func_148920_c().chunkXPos * 16; int var3 = p_147287_1_.func_148920_c().chunkZPos * 16; if (p_147287_1_.func_148921_d() != null) { DataInputStream var4 = new DataInputStream(new ByteArrayInputStream(p_147287_1_.func_148921_d())); try { for (int var5 = 0; var5 < p_147287_1_.func_148922_e(); ++var5) { short var6 = var4.readShort(); short var7 = var4.readShort(); int var8 = var7 >> 4 & 4095; int var9 = var7 & 15; int var10 = var6 >> 12 & 15; int var11 = var6 >> 8 & 15; int var12 = var6 & 255; this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(var8), var9); } } catch (IOException var13) { ; } } }
public void handleMultiBlockChange(S22PacketMultiBlockChange p_147287_1_) { int i = p_147287_1_.func_148920_c().chunkXPos * 16; int j = p_147287_1_.func_148920_c().chunkZPos * 16; if (p_147287_1_.func_148921_d() != null) { DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(p_147287_1_.func_148921_d())); try { for (int k = 0; k < p_147287_1_.func_148922_e(); ++k) { short short1 = datainputstream.readShort(); short short2 = datainputstream.readShort(); int l = short2 >> 4 & 4095; int i1 = short2 & 15; int j1 = short1 >> 12 & 15; int k1 = short1 >> 8 & 15; int l1 = short1 & 255; this.clientWorldController.func_147492_c(j1 + i, l1, k1 + j, Block.getBlockById(l), i1); } } catch (IOException ioexception) { ; } } }
public void onUpdate() { if (this.numBlocksToUpdate != 0) { if (this.numBlocksToUpdate == 1) { int i = (this.locationOfBlockChange[0] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; int j = this.locationOfBlockChange[0] & 255; int k = (this.locationOfBlockChange[0] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; BlockPos blockpos = new BlockPos(i, j, k); this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) { this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); } } else if (this.numBlocksToUpdate == 64) { int i1 = this.chunkCoords.chunkXPos * 16; int k1 = this.chunkCoords.chunkZPos * 16; this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); for (int i2 = 0; i2 < 16; ++i2) { if ((this.flagsYAreasToUpdate & 1 << i2) != 0) { int k2 = i2 << 4; List<TileEntity> list = PlayerManager.this.theWorldServer.getTileEntitiesIn(i1, k2, k1, i1 + 16, k2 + 16, k1 + 16); for (int l = 0; l < list.size(); ++l) { this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(l)); } } } } else { this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) { int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; int j2 = this.locationOfBlockChange[j1] & 255; int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; BlockPos blockpos1 = new BlockPos(l1, j2, l2); if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) { this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); } } } this.numBlocksToUpdate = 0; this.flagsYAreasToUpdate = 0; } }
public void sendChunkUpdate() { if (this.numberOfTilesToUpdate != 0) { int var1; int var2; int var3; if (this.numberOfTilesToUpdate == 1) { var1 = this.chunkLocation.chunkXPos * 16 + (this.field_151254_d[0] >> 12 & 15); var2 = this.field_151254_d[0] & 255; var3 = this.chunkLocation.chunkZPos * 16 + (this.field_151254_d[0] >> 8 & 15); this.func_151251_a(new S23PacketBlockChange(var1, var2, var3, PlayerManager.this.theWorldServer)); if (PlayerManager.this.theWorldServer.getBlock(var1, var2, var3).hasTileEntity()) { this.func_151252_a(PlayerManager.this.theWorldServer.getTileEntity(var1, var2, var3)); } } else { int var4; if (this.numberOfTilesToUpdate == 64) { var1 = this.chunkLocation.chunkXPos * 16; var2 = this.chunkLocation.chunkZPos * 16; this.func_151251_a(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate)); for (var3 = 0; var3 < 16; ++var3) { if ((this.flagsYAreasToUpdate & 1 << var3) != 0) { var4 = var3 << 4; List var5 = PlayerManager.this.theWorldServer.func_147486_a(var1, var4, var2, var1 + 16, var4 + 16, var2 + 16); for (int var6 = 0; var6 < var5.size(); ++var6) { this.func_151252_a((TileEntity)var5.get(var6)); } } } } else { this.func_151251_a(new S22PacketMultiBlockChange(this.numberOfTilesToUpdate, this.field_151254_d, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos))); for (var1 = 0; var1 < this.numberOfTilesToUpdate; ++var1) { var2 = this.chunkLocation.chunkXPos * 16 + (this.field_151254_d[var1] >> 12 & 15); var3 = this.field_151254_d[var1] & 255; var4 = this.chunkLocation.chunkZPos * 16 + (this.field_151254_d[var1] >> 8 & 15); if (PlayerManager.this.theWorldServer.getBlock(var2, var3, var4).hasTileEntity()) { this.func_151252_a(PlayerManager.this.theWorldServer.getTileEntity(var2, var3, var4)); } } } } this.numberOfTilesToUpdate = 0; this.flagsYAreasToUpdate = 0; } }
@SuppressWarnings("unused") 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), (this.flagsYAreasToUpdate == 0xFFFF), this.flagsYAreasToUpdate)); // CraftBukkit - send everything (including biome) if all sections flagged // 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; } }
@SuppressWarnings("unused") 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; } }
/** * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends * S21PacketChunkData */ void handleMultiBlockChange(S22PacketMultiBlockChange packetIn);
/** * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends * S21PacketChunkData */ void handleMultiBlockChange(S22PacketMultiBlockChange var1);
void handleMultiBlockChange(S22PacketMultiBlockChange p_147287_1_);