Paper/Spigot-Server-Patches/0108-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch

47 lines
3.1 KiB
Diff
Raw Normal View History

From 7ef1b66691b9ff7a782e4903c8e5f6b31bba08bb 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 9ecbc8e3e..0421052d2 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
2019-05-07 02:33:26 +02:00
@@ -563,8 +563,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
2019-04-27 08:26:04 +02:00
if (this.bL == 1) {
// CraftBukkit start - Use relative location for far away sounds
2019-04-27 08:26:04 +02:00
// this.world.b(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
2019-04-27 08:26:04 +02:00
+ 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 92acd504a..ee1b0a884 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
2019-04-27 08:26:04 +02:00
@@ -207,8 +207,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit start - Use relative location for far away sounds
2019-04-27 08:26:04 +02:00
// this.world.b(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
2019-04-27 08:26:04 +02:00
+ 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.22.0