2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 31 May 2016 22:53:50 -0400
|
2022-10-23 20:52:40 +02:00
|
|
|
Subject: [PATCH] Only send global sounds to same world if limiting radius
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2022-10-23 20:52:40 +02:00
|
|
|
Co-authored-by: Evan McCarthy <evanmccarthy@outlook.com>
|
|
|
|
Co-authored-by: lexikiq <noellekiq@gmail.com>
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
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
|
2023-09-21 22:35:39 +02:00
|
|
|
index 3bf174b1e259aebef9007c66cf2ee8b87eae7681..1a787bd4bdbbf7c78f4bf6bd7e2f36540fec7d50 100644
|
2021-06-11 14:02:28 +02: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
|
2023-09-21 22:35:39 +02:00
|
|
|
@@ -680,7 +680,7 @@ public class EnderDragon extends Mob implements Enemy {
|
2021-06-11 14:02:28 +02:00
|
|
|
// CraftBukkit start - Use relative location for far away sounds
|
2023-06-07 21:19:26 +02:00
|
|
|
// this.level().globalLevelEvent(1028, this.blockPosition(), 0);
|
|
|
|
int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16;
|
|
|
|
- for (net.minecraft.server.level.ServerPlayer player : this.level().getServer().getPlayerList().players) {
|
|
|
|
+ for (net.minecraft.server.level.ServerPlayer player : this.level().spigotConfig.dragonDeathSoundRadius > 0 ? ((ServerLevel) this.level()).players() : this.level().getServer().getPlayerList().players) { // Paper
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2023-09-10 04:28:03 +02:00
|
|
|
index 8d3f3987f2a6816752bdb2e477338d6dbdd6b7b7..c23f05f0d951e0036fe2cf524989747fe236730b 100644
|
2021-06-11 14:02:28 +02: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
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -271,7 +271,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
2021-06-11 14:02:28 +02:00
|
|
|
// CraftBukkit start - Use relative location for far away sounds
|
2023-06-07 21:19:26 +02:00
|
|
|
// this.level().globalLevelEvent(1023, new BlockPosition(this), 0);
|
|
|
|
int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16;
|
2021-11-23 15:03:50 +01:00
|
|
|
- for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
2023-06-07 21:19:26 +02:00
|
|
|
+ for (ServerPlayer player : this.level().spigotConfig.witherSpawnSoundRadius > 0 ? ((ServerLevel) this.level()).players() : this.level().getServer().getPlayerList().players) { // Paper
|
2021-06-11 14:02:28 +02:00
|
|
|
double deltaX = this.getX() - player.getX();
|
|
|
|
double deltaZ = this.getZ() - player.getZ();
|
|
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
2022-10-23 20:52:40 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
2023-06-07 21:19:26 +02:00
|
|
|
index 5bc68514a1e8a212e2681f06b918548c0ec565b6..1fddc9025a9e5079f05dd6c86f6ca43c5d51d9c3 100644
|
2022-10-23 20:52:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
|
|
|
@@ -64,7 +64,7 @@ public class EnderEyeItem extends Item {
|
|
|
|
// world.b(1038, blockposition1.c(1, 0, 1), 0);
|
|
|
|
int viewDistance = world.getCraftServer().getViewDistance() * 16;
|
|
|
|
BlockPos soundPos = blockposition1.offset(1, 0, 1);
|
|
|
|
- for (ServerPlayer player : world.getServer().getPlayerList().players) {
|
|
|
|
+ for (ServerPlayer player : world.spigotConfig.endPortalSoundRadius > 0 ? ((ServerLevel) world).players() : world.getServer().getPlayerList().players) { // Paper
|
|
|
|
double deltaX = soundPos.getX() - player.getX();
|
|
|
|
double deltaZ = soundPos.getZ() - player.getZ();
|
|
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|