Only limit global sounds to same world if limiting radius (#8499)

This commit is contained in:
evan 2022-10-23 13:52:40 -05:00 committed by GitHub
parent 44ce9b3e9c
commit 1c1aeb20e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
146 changed files with 37 additions and 43 deletions

View File

@ -1,12 +1,13 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 31 May 2016 22:53:50 -0400
Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
Subject: [PATCH] Only send global sounds to same world if limiting radius
Also fix view distance lookup
Co-authored-by: Evan McCarthy <evanmccarthy@outlook.com>
Co-authored-by: lexikiq <noellekiq@gmail.com>
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
index dd1d606543da93e6068b8fa4239d369a4b648523..e6a6b0a298e69ce975eac413723f068aaef72ec0 100644
index dd1d606543da93e6068b8fa4239d369a4b648523..127aab56eef67d7f02f5c3de80d8f445ba70e7db 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -654,7 +654,7 @@ public class EnderDragon extends Mob implements Enemy {
@ -14,12 +15,12 @@ index dd1d606543da93e6068b8fa4239d369a4b648523..e6a6b0a298e69ce975eac413723f068a
// this.world.b(1028, this.getChunkCoordinates(), 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 : (List<net.minecraft.server.level.ServerPlayer>) ((ServerLevel)level).players()) {
+ for (net.minecraft.server.level.ServerPlayer player : level.spigotConfig.dragonDeathSoundRadius > 0 ? ((ServerLevel) level).players() : level.getServer().getPlayerList().players) { // Paper
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
index 78bffaddbc9e478fb53639396e9c4970e9961b21..1fc862a3b5d40a45cf91703051bcfb06ec1b177a 100644
index 78bffaddbc9e478fb53639396e9c4970e9961b21..0d36a903b7aa8d26232e6edcb0fdbba1defde660 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -272,7 +272,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@ -27,7 +28,20 @@ index 78bffaddbc9e478fb53639396e9c4970e9961b21..1fc862a3b5d40a45cf91703051bcfb06
// this.world.globalLevelEvent(1023, new BlockPosition(this), 0);
int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
- for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ for (ServerPlayer player : (List<ServerPlayer>)this.level.players()) { // Paper
+ for (ServerPlayer player : level.spigotConfig.witherSpawnSoundRadius > 0 ? ((ServerLevel) level).players() : level.getServer().getPlayerList().players) { // Paper
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/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;

View File

@ -1,20 +0,0 @@
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 a88ffff41481d346a99762352094cdb4e8dd6cc2..0b3e9e4ed162a6d9e1f3f55b9522b75c94d13254 100644
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
@@ -68,7 +68,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;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Validate usernames
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index b87bd1c2d3a371e2fca1d0bff6d0985188b22584..64e2004e023f79d28c400f7182b0ffa93789620d 100644
index dd599443c7197868eaa0708b4be26f1a341ce4e4..82b55548d4652ec0c25d3dc6da628573a9c9000a 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -66,6 +66,7 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 64e2004e023f79d28c400f7182b0ffa93789620d..dff440dc51724e85d9fea88a9602efcbb5450776 100644
index 82b55548d4652ec0c25d3dc6da628573a9c9000a..62a404871650ff5caffcd9c6c83046abeefff49d 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -411,7 +411,7 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se

View File

@ -12,7 +12,7 @@ already-existing field on AbstractArrow for tracking entities hit by
piercing arrows to avoid duplicate damage being applied.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 8564ecd20578d907bcfa1b9c149da22e424e254a..bc01e5014e1355a225bdf5c47f2965290b45e2d2 100644
index 39136b9707221e4e4934ee0ef18fc2cb92723aa2..def3b3f8dac4b28eaaafdd9bc2e7f4b9ec9d6855 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -300,6 +300,19 @@ public abstract class AbstractArrow extends Projectile {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Allow to change the podium for the EnderDragon
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
index 6495b0421cab1b067b9483cc448222705c15578c..ac3d4d90407288526a8c787e365ff41234a58543 100644
index 3f854bea2e6be82c7ad12b4d13064de8baec55c7..b786bd5178a605a5dfb7682b7cb809646895aea3 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -99,6 +99,10 @@ public class EnderDragon extends Mob implements Enemy {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix StructureGrowEvent species for RED_MUSHROOM
diff --git a/src/main/java/net/minecraft/world/level/block/MushroomBlock.java b/src/main/java/net/minecraft/world/level/block/MushroomBlock.java
index 5333188e45e47c12c8c56939b87603750a45af57..881d899ff551bc2c2c6fc7d58107a2aee7d86f2a 100644
index 30dac710f355de75e620b807f88c6a209615b05f..88a7b38f33500a618f42aed427e7e15db9e837b3 100644
--- a/src/main/java/net/minecraft/world/level/block/MushroomBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/MushroomBlock.java
@@ -85,7 +85,7 @@ public class MushroomBlock extends BushBlock implements BonemealableBlock {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] FallingBlock auto expire setting
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index f6405e862b15b71dbb96215e604610fe5ff59bfc..ef07967b64180c54338b8fb2ba1780adec87f333 100644
index da00fab453f3fb580acc9de65a0853656f9b6fc4..b2d1a17867cdbaad0c6e5c2376c716f9461af124 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -61,6 +61,7 @@ public class FallingBlockEntity extends Entity {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix Bee flower NPE
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index bd048cc30046f19f9eee89c6ba45d0816a160e67..e5de2c1d11e5de88420caba35bf75c8bbd799db5 100644
index f2243f65cdf0e4b327e8597dfefe5b2de8912cef..87f8d46cb2032474008811ca11dc7ff1f7859f7e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -802,7 +802,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {

View File

@ -29,7 +29,7 @@ index 421d7e28370085dffa415d71d4e28d3c4d38ac87..92617a19fb328320e17b58956cf0276d
d0 = to.getX();
d1 = to.getY();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c4ffccddce33cf461d9b04ccbb90026544f16b7d..99b99fae67e53a688b3519d8a8d0cc5f3468e7e8 100644
index 2015147126f463f11202d04ca475cc86e5ac12c2..a1e2664c9a6cc41edf0dfb92cd2b9d77170d8fde 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -542,15 +542,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -9,7 +9,7 @@ should be supported. Some entities (for whatever
reason) use the level's random in some places.
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index e5de2c1d11e5de88420caba35bf75c8bbd799db5..a9cdf9034ad269f7a71358443acc053288cfbe6d 100644
index 87f8d46cb2032474008811ca11dc7ff1f7859f7e..2e05c953182c27e3571b2c33eceeb379e60b54be 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -1028,7 +1028,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@ -49,7 +49,7 @@ index 4c78c04ed031ec2e04642ebe5d79527e848d95f6..fcc5444a1268931a0fd2df1e6bbbc17c
public ItemEntity(Level world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 8101f358975b35b5a2dafbade3d14a910e408fa2..e09271450cae84f6206a20d6622918fe37380d59 100644
index 65f0aa076dbfc4cd72d14ec485d1edf5533d825e..438de71a17d7bfaed8fbb1b4f7aa7f53538603a2 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -35,7 +35,7 @@ public class PrimedTnt extends Entity {

Some files were not shown because too many files have changed in this diff Show More