Paper/Spigot-Server-Patches/0103-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 48f3695861ad7f9c480d3bdf68c6820c2ca0a00a..81c926e506c1b6e5c0d909b71f1db81beb645699 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 b9501a2f5f60b70eb7f0b4ac8ef6c883585adaa5..ad5a7cbe83fb61b79203369895e82edca2ffcb72 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;