/** * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation */ public void handleChunkData(S21PacketChunkData packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.func_149274_i()) { if (packetIn.getExtractedSize() == 0) { this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), false); return; } this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), true); } this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15); Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(packetIn.getChunkX(), packetIn.getChunkZ()); chunk.fillChunk(packetIn.func_149272_d(), packetIn.getExtractedSize(), packetIn.func_149274_i()); this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15); if (!packetIn.func_149274_i() || !(this.clientWorldController.provider instanceof WorldProviderSurface)) { chunk.resetRelightChecks(); } }
/** * Updates the specified chunk with the supplied data, marks it for re-rendering * and lighting recalculation */ public void handleChunkData(S21PacketChunkData packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.func_149274_i()) { if (packetIn.getExtractedSize() == 0) { this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), false); return; } this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), true); } this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15); Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(packetIn.getChunkX(), packetIn.getChunkZ()); chunk.fillChunk(packetIn.func_149272_d(), packetIn.getExtractedSize(), packetIn.func_149274_i()); this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15); if (!packetIn.func_149274_i() || !(this.clientWorldController.provider instanceof WorldProviderSurface)) { chunk.resetRelightChecks(); } }
public void resyncChunksFull() { if (w.isRemote) return; Chunk chunk = getChunk(); final WorldServer world = (WorldServer) chunk.getWorld(); final PlayerManager pm = world.getPlayerManager(); PlayerManager.PlayerInstance watcher = pm.getPlayerInstance(chunk.xPosition, chunk.zPosition, false); if (watcher == null) return; ArrayList<EntityPlayerMP> players = new ArrayList<EntityPlayerMP>(); players.addAll(watcher.playersWatchingChunk); for (EntityPlayerMP player : players) { watcher.removePlayer(player); watcher.addPlayer(player); } Packet packet = new S21PacketChunkData(chunk, true, -1); FzNetDispatch.addPacketFrom(packet, chunk); }
/** * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation */ public void handleChunkData(S21PacketChunkData p_147263_1_) { if (p_147263_1_.func_149274_i()) { if (p_147263_1_.func_149276_g() == 0) { this.clientWorldController.doPreChunk(p_147263_1_.func_149273_e(), p_147263_1_.func_149271_f(), false); return; } this.clientWorldController.doPreChunk(p_147263_1_.func_149273_e(), p_147263_1_.func_149271_f(), true); } this.clientWorldController.invalidateBlockReceiveRegion(p_147263_1_.func_149273_e() << 4, 0, p_147263_1_.func_149271_f() << 4, (p_147263_1_.func_149273_e() << 4) + 15, 256, (p_147263_1_.func_149271_f() << 4) + 15); Chunk var2 = this.clientWorldController.getChunkFromChunkCoords(p_147263_1_.func_149273_e(), p_147263_1_.func_149271_f()); var2.fillChunk(p_147263_1_.func_149272_d(), p_147263_1_.func_149276_g(), p_147263_1_.func_149270_h(), p_147263_1_.func_149274_i()); this.clientWorldController.markBlockRangeForRenderUpdate(p_147263_1_.func_149273_e() << 4, 0, p_147263_1_.func_149271_f() << 4, (p_147263_1_.func_149273_e() << 4) + 15, 256, (p_147263_1_.func_149271_f() << 4) + 15); if (!p_147263_1_.func_149274_i() || !(this.clientWorldController.provider instanceof WorldProviderSurface)) { var2.resetRelightChecks(); } }
public void handleChunkData(S21PacketChunkData p_147263_1_) { if (p_147263_1_.func_149274_i()) { if (p_147263_1_.func_149276_g() == 0) { this.clientWorldController.doPreChunk(p_147263_1_.func_149273_e(), p_147263_1_.func_149271_f(), false); return; } this.clientWorldController.doPreChunk(p_147263_1_.func_149273_e(), p_147263_1_.func_149271_f(), true); } this.clientWorldController.invalidateBlockReceiveRegion(p_147263_1_.func_149273_e() << 4, 0, p_147263_1_.func_149271_f() << 4, (p_147263_1_.func_149273_e() << 4) + 15, 256, (p_147263_1_.func_149271_f() << 4) + 15); Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(p_147263_1_.func_149273_e(), p_147263_1_.func_149271_f()); chunk.fillChunk(p_147263_1_.func_149272_d(), p_147263_1_.func_149276_g(), p_147263_1_.func_149270_h(), p_147263_1_.func_149274_i()); this.clientWorldController.markBlockRangeForRenderUpdate(p_147263_1_.func_149273_e() << 4, 0, p_147263_1_.func_149271_f() << 4, (p_147263_1_.func_149273_e() << 4) + 15, 256, (p_147263_1_.func_149271_f() << 4) + 15); if (!p_147263_1_.func_149274_i() || !(this.clientWorldController.provider instanceof WorldProviderSurface)) { chunk.resetRelightChecks(); } }
public void removePlayer(EntityPlayerMP player) { if (this.playersWatchingChunk.contains(player)) { Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); if (chunk.isPopulated()) { player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); } this.playersWatchingChunk.remove(player); player.loadedChunks.remove(this.chunkCoords); if (this.playersWatchingChunk.isEmpty()) { long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; this.increaseInhabitedTime(chunk); PlayerManager.this.playerInstances.remove(i); PlayerManager.this.playerInstanceList.remove(this); if (this.numBlocksToUpdate > 0) { PlayerManager.this.playerInstancesToUpdate.remove(this); } PlayerManager.this.getWorldServer().theChunkProviderServer.dropChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); } } }
/** * Notify all nearby players about chunk changes * @param chunk Chunk to notify */ @SuppressWarnings({"unchecked"}) public void notifyChunk(Chunk chunk) { for (EntityPlayer player : (ArrayList<EntityPlayer>)world.playerEntities) { if (player instanceof EntityPlayerMP) { EntityPlayerMP playerMP = (EntityPlayerMP) player; if ( Math.abs(playerMP.chunkCoordX - chunk.xPosition) <= 32 && Math.abs(playerMP.chunkCoordZ - chunk.zPosition) <= 32) { playerMP.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 65535)); } } } }
public void removePlayer(EntityPlayerMP par1EntityPlayerMP, boolean sendData) { if (this.playersWatchingChunk.contains(par1EntityPlayerMP)) { Chunk var2 = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos); if (sendData && var2.func_150802_k()) { par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S21PacketChunkData(var2, true, 0)); } this.playersWatchingChunk.remove(par1EntityPlayerMP); par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation); if (Reflector.EventBus.exists()) { Reflector.postForgeBusEvent(Reflector.ChunkWatchEvent_UnWatch_Constructor, new Object[] {this.chunkLocation, par1EntityPlayerMP}); } if (this.playersWatchingChunk.isEmpty()) { long var3 = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; this.increaseInhabitedTime(var2); PlayerManager.this.playerInstances.remove(var3); PlayerManager.this.playerInstanceList.remove(this); if (this.numberOfTilesToUpdate > 0) { PlayerManager.this.chunkWatcherWithPlayers.remove(this); } if (this.chunkLoaded) { PlayerManager.this.getWorldServer().theChunkProviderServer.unloadChunksIfNotNearSpawn(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos); } } } }
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; } }
/** * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation */ void handleChunkData(S21PacketChunkData packetIn);
/** * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation */ void handleChunkData(S21PacketChunkData var1);
void handleChunkData(S21PacketChunkData p_147263_1_);