2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2016-06-01 05:56:19 +02:00
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
2020-05-06 11:48:49 +02:00
index d4fd58414c98a0ba10bbea7fc0ecef44e8ac8d60..87625776963d6143d570cda8e72fda6b3f50047f 100644
2016-06-01 05:56:19 +02:00
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
2019-12-12 00:43:22 +01:00
@@ -572,8 +572,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
if (this.bA == 1) {
2016-06-01 05:56:19 +02:00
// 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);
2016-06-01 05:56:19 +02:00
- 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
2016-06-01 05:56:19 +02:00
+ // Paper end
2019-12-12 00:43:22 +01:00
double deltaX = this.locX() - player.locX();
double deltaZ = this.locZ() - player.locZ();
2016-06-01 05:56:19 +02:00
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
2020-05-06 11:48:49 +02:00
index 2edf466ee24841cf1cc3b6a8c896ea82f09c17fd..2e95069c1907df951680f2a00441a72500c48430 100644
2016-06-01 05:56:19 +02:00
--- 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 {
2016-06-01 05:56:19 +02:00
// 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);
2016-06-01 05:56:19 +02:00
- 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
2016-06-01 05:56:19 +02:00
+ // Paper end
2019-12-12 00:43:22 +01:00
double deltaX = this.locX() - player.locX();
double deltaZ = this.locZ() - player.locZ();
2016-06-01 05:56:19 +02:00
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;