/** * Sends the specified packet to all players either in specified chunk, or at least have that chunk loaded */ public static void sendToAllWatchingChunk(Chunk chunk, Packet packet) { World world = chunk.worldObj; if (world instanceof WorldServer) { PlayerManager playerManager = ((WorldServer) world).getPlayerManager(); PlayerInstance playerInstance = playerManager.getOrCreateChunkWatcher(chunk.xPosition, chunk.zPosition, false); if (playerInstance != null) { playerInstance.sendToAllPlayersWatchingChunk(packet); } } }
public void func_72687_a(int p_72687_1_, int p_72687_2_, int p_72687_3_) { int var4 = p_72687_1_ >> 4; int var5 = p_72687_3_ >> 4; PlayerInstance var6 = this.func_72690_a(var4, var5, false); if(var6 != null) { var6.func_73259_a(p_72687_1_ & 15, p_72687_2_, p_72687_3_ & 15); } }
public void func_72695_c(EntityPlayerMP p_72695_1_) { int var2 = (int)p_72695_1_.field_71131_d >> 4; int var3 = (int)p_72695_1_.field_71132_e >> 4; for(int var4 = var2 - this.field_72698_e; var4 <= var2 + this.field_72698_e; ++var4) { for(int var5 = var3 - this.field_72698_e; var5 <= var3 + this.field_72698_e; ++var5) { PlayerInstance var6 = this.func_72690_a(var4, var5, false); if(var6 != null) { var6.func_73252_b(p_72695_1_); } } } this.field_72699_b.remove(p_72695_1_); }
public void func_72685_d(EntityPlayerMP p_72685_1_) { int var2 = (int)p_72685_1_.field_70165_t >> 4; int var3 = (int)p_72685_1_.field_70161_v >> 4; double var4 = p_72685_1_.field_71131_d - p_72685_1_.field_70165_t; double var6 = p_72685_1_.field_71132_e - p_72685_1_.field_70161_v; double var8 = var4 * var4 + var6 * var6; if(var8 >= 64.0D) { int var10 = (int)p_72685_1_.field_71131_d >> 4; int var11 = (int)p_72685_1_.field_71132_e >> 4; int var12 = this.field_72698_e; int var13 = var2 - var10; int var14 = var3 - var11; if(var13 != 0 || var14 != 0) { for(int var15 = var2 - var12; var15 <= var2 + var12; ++var15) { for(int var16 = var3 - var12; var16 <= var3 + var12; ++var16) { if(!this.func_72684_a(var15, var16, var10, var11, var12)) { this.func_72690_a(var15, var16, true).func_73255_a(p_72685_1_); } if(!this.func_72684_a(var15 - var13, var16 - var14, var2, var3, var12)) { PlayerInstance var17 = this.func_72690_a(var15 - var13, var16 - var14, false); if(var17 != null) { var17.func_73252_b(p_72685_1_); } } } } this.func_72691_b(p_72685_1_); p_72685_1_.field_71131_d = p_72685_1_.field_70165_t; p_72685_1_.field_71132_e = p_72685_1_.field_70161_v; } } }
public void func_72691_b(EntityPlayerMP p_72691_1_) { ArrayList var2 = new ArrayList(p_72691_1_.field_71129_f); int var3 = 0; int var4 = this.field_72698_e; int var5 = (int)p_72691_1_.field_70165_t >> 4; int var6 = (int)p_72691_1_.field_70161_v >> 4; int var7 = 0; int var8 = 0; ChunkCoordIntPair var9 = PlayerInstance.func_73253_a(this.func_72690_a(var5, var6, true)); p_72691_1_.field_71129_f.clear(); if(var2.contains(var9)) { p_72691_1_.field_71129_f.add(var9); } int var10; for(var10 = 1; var10 <= var4 * 2; ++var10) { for(int var11 = 0; var11 < 2; ++var11) { int[] var12 = this.field_72696_f[var3++ % 4]; for(int var13 = 0; var13 < var10; ++var13) { var7 += var12[0]; var8 += var12[1]; var9 = PlayerInstance.func_73253_a(this.func_72690_a(var5 + var7, var6 + var8, true)); if(var2.contains(var9)) { p_72691_1_.field_71129_f.add(var9); } } } } var3 %= 4; for(var10 = 0; var10 < var4 * 2; ++var10) { var7 += this.field_72696_f[var3][0]; var8 += this.field_72696_f[var3][1]; var9 = PlayerInstance.func_73253_a(this.func_72690_a(var5 + var7, var6 + var8, true)); if(var2.contains(var9)) { p_72691_1_.field_71129_f.add(var9); } } }
public boolean func_72694_a(EntityPlayerMP p_72694_1_, int p_72694_2_, int p_72694_3_) { PlayerInstance var4 = this.func_72690_a(p_72694_2_, p_72694_3_, false); return var4 == null?false:PlayerInstance.func_73258_b(var4).contains(p_72694_1_) && !p_72694_1_.field_71129_f.contains(PlayerInstance.func_73253_a(var4)); }
/** * <p>Send the given packet to all players tracking the Chunk at the given coordinates in the given world.</p> * @param packet the packet * @param world the world * @param chunkX the chunk x coordinate * @param chunkZ the chunk z coordinate */ public static void sendToAllTrackingChunk(Packet packet, World world, int chunkX, int chunkZ) { PlayerInstance pi = checkNotClient(world).getPlayerManager().getOrCreateChunkWatcher(chunkX, chunkZ, false); if (pi != null) { pi.sendToAllPlayersWatchingChunk(packet); } }