/** * 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(SPacketMultiBlockChange packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); for (SPacketMultiBlockChange.BlockUpdateData spacketmultiblockchange$blockupdatedata : packetIn.getChangedBlocks()) { this.clientWorldController.invalidateRegionAndSetBlock(spacketmultiblockchange$blockupdatedata.getPos(), spacketmultiblockchange$blockupdatedata.getBlockState()); } }
public void update() { if (this.sentToPlayers && this.chunk != null) { if (this.changes != 0) { if (this.changes == 1) { int i = (this.changedBlocks[0] >> 12 & 15) + this.pos.chunkXPos * 16; int j = this.changedBlocks[0] & 255; int k = (this.changedBlocks[0] >> 8 & 15) + this.pos.chunkZPos * 16; BlockPos blockpos = new BlockPos(i, j, k); this.sendPacket(new SPacketBlockChange(this.playerChunkMap.getWorldServer(), blockpos)); if (this.playerChunkMap.getWorldServer().getBlockState(blockpos).getBlock().hasTileEntity()) { this.sendBlockEntity(this.playerChunkMap.getWorldServer().getTileEntity(blockpos)); } } else if (this.changes == 64) { this.sendPacket(new SPacketChunkData(this.chunk, this.changedSectionFilter)); } else { this.sendPacket(new SPacketMultiBlockChange(this.changes, this.changedBlocks, this.chunk)); for (int l = 0; l < this.changes; ++l) { int i1 = (this.changedBlocks[l] >> 12 & 15) + this.pos.chunkXPos * 16; int j1 = this.changedBlocks[l] & 255; int k1 = (this.changedBlocks[l] >> 8 & 15) + this.pos.chunkZPos * 16; BlockPos blockpos1 = new BlockPos(i1, j1, k1); if (this.playerChunkMap.getWorldServer().getBlockState(blockpos1).getBlock().hasTileEntity()) { this.sendBlockEntity(this.playerChunkMap.getWorldServer().getTileEntity(blockpos1)); } } } this.changes = 0; this.changedSectionFilter = 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(SPacketMultiBlockChange packetIn);