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
|
2022-12-07 19:52:24 +01:00
|
|
|
index fb26b6919acfb036affbe5519f5e4bd77955534f..89366ca29386fcbd03c3fc94d58451e714a1d779 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
|
2022-09-26 10:02:51 +02:00
|
|
|
@@ -654,7 +654,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
|
|
|
|
// this.world.b(1028, this.getChunkCoordinates(), 0);
|
2022-09-26 10:02:51 +02:00
|
|
|
int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
|
2021-06-11 14:02:28 +02:00
|
|
|
- for (net.minecraft.server.level.ServerPlayer player : this.level.getServer().getPlayerList().players) {
|
2022-10-23 20:52:40 +02:00
|
|
|
+ for (net.minecraft.server.level.ServerPlayer player : level.spigotConfig.dragonDeathSoundRadius > 0 ? ((ServerLevel) level).players() : 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
|
2022-12-07 19:52:24 +01:00
|
|
|
index ae3931d65f6d8b91a654f3a7a4448d168eb526fc..807c8e18fdf5b0704638d7d084d6892556cc1525 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
|
2022-12-07 19:52:24 +01:00
|
|
|
@@ -270,7 +270,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
|
2021-11-23 14:22:49 +01:00
|
|
|
// this.world.globalLevelEvent(1023, new BlockPosition(this), 0);
|
2022-09-26 10:02:51 +02:00
|
|
|
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) {
|
2022-10-23 20:52:40 +02:00
|
|
|
+ for (ServerPlayer player : level.spigotConfig.witherSpawnSoundRadius > 0 ? ((ServerLevel) level).players() : 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
|
|
|
|
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;
|