From f141e318dd22df3d6fdc2eb58f4e3d5447fdb4f8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 31 May 2016 22:53:50 -0400 Subject: [PATCH] Only send Dragon/Wither Death sounds to same world Also fix view distance lookup diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java index d4fd58414c..8762577696 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -572,8 +572,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { if (this.bA == 1) { // CraftBukkit start - Use relative location for far away sounds // this.world.b(1028, new BlockPosition(this), 0); - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; - for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { + // Paper start + //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + for (EntityPlayer player : ((WorldServer)world).getPlayers()) { + final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + // Paper end double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java index 2edf466ee2..2e95069c19 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java @@ -207,8 +207,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity { // CraftBukkit start - Use relative location for far away sounds // this.world.b(1023, new BlockPosition(this), 0); - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; - for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { + // Paper start + //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + for (EntityPlayer player : ((WorldServer)world).getPlayers()) { + final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + // Paper end double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -- 2.26.2