From 2d458ee14f89df73b08937edcc5852c18a996942 Mon Sep 17 00:00:00 2001 From: Lexi Date: Thu, 30 Dec 2021 22:50:44 -0500 Subject: [PATCH] Check player world in endPortalSoundRadius (#6226) Co-authored-by: Jake Potrebic --- ...player-world-in-endPortalSoundRadius.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/server/0842-Check-player-world-in-endPortalSoundRadius.patch diff --git a/patches/server/0842-Check-player-world-in-endPortalSoundRadius.patch b/patches/server/0842-Check-player-world-in-endPortalSoundRadius.patch new file mode 100644 index 0000000000..2cad4659f6 --- /dev/null +++ b/patches/server/0842-Check-player-world-in-endPortalSoundRadius.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: lexikiq +Date: Sat, 17 Jul 2021 20:37:02 -0400 +Subject: [PATCH] Check player world in endPortalSoundRadius + +Fixes Spigot's endPortalSoundRadius not checking player worlds + +diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java +index 7ccfe737fdf7f07b731ea0ff82e897564350705c..46ca1a11930c57813fbcbab7de7dd2fd47241f64 100644 +--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java ++++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java +@@ -66,7 +66,7 @@ public class EnderEyeItem extends Item { + double deltaX = soundPos.getX() - player.getX(); + double deltaZ = soundPos.getZ() - player.getZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; +- if (world.spigotConfig.endPortalSoundRadius > 0 && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot ++ if (world.spigotConfig.endPortalSoundRadius > 0 && (distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius || player.getLevel() != world)) continue; // Spigot // Paper - ensure recipient is in same world as portal + if (distanceSquared > viewDistance * viewDistance) { + double deltaLength = Math.sqrt(distanceSquared); + double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;