Check player world in endPortalSoundRadius (#6226)

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Lexi 2021-12-30 22:50:44 -05:00 committed by GitHub
parent 721f14842f
commit 2d458ee14f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lexikiq <noellekiq@gmail.com>
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;