From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 31 May 2016 22:53:50 -0400 Subject: [PATCH] Only send global sounds to same world if limiting radius Co-authored-by: Evan McCarthy Co-authored-by: lexikiq 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 29798faa9cc9aead40e3329307dc63cb7bf838b6..27f99f9ce39aac0bae5e9a7b34fd63833aa4ad26 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 @@ -689,7 +689,7 @@ public class EnderDragon extends Mob implements Enemy { // CraftBukkit start - Use relative location for far away sounds // this.level().globalLevelEvent(1028, this.blockPosition(), 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 : this.level().spigotConfig.dragonDeathSoundRadius > 0 ? ((ServerLevel) this.level()).players() : this.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 8d3f3987f2a6816752bdb2e477338d6dbdd6b7b7..c23f05f0d951e0036fe2cf524989747fe236730b 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 @@ -271,7 +271,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob // CraftBukkit start - Use relative location for far away sounds // this.level().globalLevelEvent(1023, new BlockPosition(this), 0); int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16; - for (ServerPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { + for (ServerPlayer player : this.level().spigotConfig.witherSpawnSoundRadius > 0 ? ((ServerLevel) this.level()).players() : this.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 5bc68514a1e8a212e2681f06b918548c0ec565b6..1fddc9025a9e5079f05dd6c86f6ca43c5d51d9c3 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;