mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Only limit global sounds to same world if limiting radius (#8499)
This commit is contained in:
parent
bac7ba4c5a
commit
95bd943ca3
2 changed files with 18 additions and 24 deletions
|
@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
|
@ -1,9 +1,10 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -14,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// 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;
|
||||
|
@ -27,7 +28,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
Loading…
Reference in a new issue