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
|
2022-10-23 18:52:40 +00:00
|
|
|
Subject: [PATCH] Only send global sounds to same world if limiting radius
|
2021-06-11 12:02:28 +00:00
|
|
|
|
2022-10-23 18:52:40 +00:00
|
|
|
Co-authored-by: Evan McCarthy <evanmccarthy@outlook.com>
|
|
|
|
Co-authored-by: lexikiq <noellekiq@gmail.com>
|
2021-06-11 12:02:28 +00: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
|
2022-10-23 18:52:40 +00:00
|
|
|
index dd1d606543da93e6068b8fa4239d369a4b648523..127aab56eef67d7f02f5c3de80d8f445ba70e7db 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-09-26 08:02:51 +00:00
|
|
|
@@ -654,7 +654,7 @@ public class EnderDragon extends Mob implements Enemy {
|
2021-06-11 12:02:28 +00:00
|
|
|
// CraftBukkit start - Use relative location for far away sounds
|
|
|
|
// this.world.b(1028, this.getChunkCoordinates(), 0);
|
2022-09-26 08:02:51 +00:00
|
|
|
int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
|
2021-06-11 12:02:28 +00:00
|
|
|
- for (net.minecraft.server.level.ServerPlayer player : this.level.getServer().getPlayerList().players) {
|
2022-10-23 18:52:40 +00:00
|
|
|
+ for (net.minecraft.server.level.ServerPlayer player : level.spigotConfig.dragonDeathSoundRadius > 0 ? ((ServerLevel) level).players() : level.getServer().getPlayerList().players) { // Paper
|
2021-06-11 12:02:28 +00: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
|
2022-10-23 18:52:40 +00:00
|
|
|
index 78bffaddbc9e478fb53639396e9c4970e9961b21..0d36a903b7aa8d26232e6edcb0fdbba1defde660 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-09-26 08:02:51 +00:00
|
|
|
@@ -272,7 +272,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
2021-06-11 12:02:28 +00:00
|
|
|
// 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);
|
2022-09-26 08:02:51 +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) {
|
2022-10-23 18:52:40 +00:00
|
|
|
+ for (ServerPlayer player : level.spigotConfig.witherSpawnSoundRadius > 0 ? ((ServerLevel) level).players() : level.getServer().getPlayerList().players) { // Paper
|
2021-06-11 12:02:28 +00:00
|
|
|
double deltaX = this.getX() - player.getX();
|
|
|
|
double deltaZ = this.getZ() - player.getZ();
|
|
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
2022-10-23 18:52:40 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
|
|
|
index a88ffff41481d346a99762352094cdb4e8dd6cc2..e0c3aa1285709a40ff0ea8c1d74d43d2b341aecc 100644
|
|
|
|
--- 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;
|