papermc/patches/server/0098-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch

40 lines
3.4 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
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/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
2022-06-07 19:55:39 +00:00
index 13fa9c47a95571d63b590c595e15e9a15c2f6a65..7b64b14b1d2c0e242a5d8e8602e49b185fcf8839 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
2022-06-07 19:55:39 +00:00
@@ -633,8 +633,9 @@ public class EnderDragon extends Mob implements Enemy {
2021-06-11 12:02:28 +00:00
if (this.dragonDeathTime == 1 && !this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds
// this.world.b(1028, this.getChunkCoordinates(), 0);
- int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
- for (net.minecraft.server.level.ServerPlayer player : this.level.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 (net.minecraft.server.level.ServerPlayer player : (List<net.minecraft.server.level.ServerPlayer>) ((ServerLevel)level).players()) {
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
double deltaX = this.getX() - player.getX();
double deltaZ = this.getZ() - player.getZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
2022-03-01 05:43:03 +00:00
index 78bffaddbc9e478fb53639396e9c4970e9961b21..32b302aad0319ce3ee412912425c1c8db9979f8a 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
2022-03-01 05:43:03 +00:00
@@ -271,8 +271,9 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
2021-06-11 12:02:28 +00:00
if (!this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds
2021-11-23 13:22:49 +00:00
// this.world.globalLevelEvent(1023, new BlockPosition(this), 0);
2021-06-11 12:02:28 +00:00
- int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
2021-11-23 14:03:50 +00:00
- for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) {
2021-11-23 13:22:49 +00:00
+ //int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
2021-11-23 14:03:50 +00:00
+ for (ServerPlayer player : (List<ServerPlayer>)this.level.players()) { // Paper
2021-06-11 12:02:28 +00:00
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
double deltaX = this.getX() - player.getX();
double deltaZ = this.getZ() - player.getZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;