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

40 lines
3.2 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 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 61f06933ef5405a088dba4282c7857976f406efb..1627fdb2ef8551e1c63034b496a2c9bfb12d0e38 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
2020-06-25 13:00:35 +02:00
@@ -570,8 +570,9 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
if (this.deathAnimationTicks == 1 && !this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds
2020-06-25 13:00:35 +02:00
// this.world.b(1028, this.getChunkCoordinates(), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
2020-06-25 13:00:35 +02:00
+ //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 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 : (List<EntityPlayer>) ((WorldServer)world).getPlayers()) {
2019-04-27 08:26:04 +02:00
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
2019-12-12 00:43:22 +01:00
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 5fd3f79d825e0b583d94a93d79ca86ecb72050f2..dd4d12f4e3ab5385b85504bde962adce2981dfb5 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
2020-06-25 13:00:35 +02:00
@@ -208,8 +208,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (!this.isSilent()) {
// 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<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 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 : (List<EntityPlayer>)this.world.getPlayers()) {
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
double deltaX = this.locX() - player.locX();
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;