Only send Dragon/Wither Death sounds to same world

Also fix view distance lookup
This commit is contained in:
Aikar 2016-05-31 23:56:19 -04:00
parent 1aef85c2bb
commit 4becba32a6

View File

@ -0,0 +1,48 @@
From dfa68f3709355d61d9a72b148bbe0e3cd545e1e0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 be898c2..86eddc8 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -555,8 +555,12 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
if (this.bG == 1) {
// CraftBukkit start - Use relative location for far away sounds
// this.world.a(1028, new BlockPosition(this), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
- for (EntityPlayer player : (List<EntityPlayer>) 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 (EntityHuman human : world.players) {
+ EntityPlayer player = (EntityPlayer) human;
+ int viewDistance = player.getViewDistance();
+ // 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 d8c366b..af86437 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -198,8 +198,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit start - Use relative location for far away sounds
// this.world.a(1023, new BlockPosition(this), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
- for (EntityPlayer player : (List<EntityPlayer>) 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 (EntityHuman human : world.players) {
+ EntityPlayer player = (EntityPlayer) human;
+ int viewDistance = player.getViewDistance();
+ // Paper end
double deltaX = this.locX - player.locX;
double deltaZ = this.locZ - player.locZ;
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
--
2.8.3