Skip to content

Commit

Permalink
Fix that sounds will play in other worlds with radius
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoenix616 committed Aug 5, 2020
1 parent 2a9f929 commit f5d6cd6
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From dde8ad35c629c2435569ac9c00cdbf56075199a6 Mon Sep 17 00:00:00 2001
From d1b2a4e8cdfc8de0d115d82de02c6d24ffd60889 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Fri, 12 Jun 2020 21:43:36 +0100
Subject: [PATCH] Only play sound in same world if radius is set
Expand All @@ -13,7 +13,7 @@ Integer.MAX_VALUE I guess.
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 63a759cc18..86996473f9 100644
index 63a759cc18..b11bf6768f 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -577,13 +577,13 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
Expand All @@ -28,12 +28,12 @@ index 63a759cc18..86996473f9 100644
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
- if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot
+ if ( world.spigotConfig.dragonDeathSoundRadius > 0 && player.world == this.world && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot // Origami - only play sound in same world if radius is set
+ if ( world.spigotConfig.dragonDeathSoundRadius > 0 && (player.world != this.world || distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius) ) continue; // Spigot // Origami - only play sound in same world if radius is set
if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 1074995e8c..0fcc956cca 100644
index 1074995e8c..fe43111924 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -209,12 +209,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
Expand All @@ -47,20 +47,20 @@ index 1074995e8c..0fcc956cca 100644
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
- if ( world.spigotConfig.witherSpawnSoundRadius > 0 && distanceSquared > world.spigotConfig.witherSpawnSoundRadius * world.spigotConfig.witherSpawnSoundRadius ) continue; // Spigot
+ if ( world.spigotConfig.witherSpawnSoundRadius > 0 && player.world == this.world && distanceSquared > world.spigotConfig.witherSpawnSoundRadius * world.spigotConfig.witherSpawnSoundRadius ) continue; // Spigot // Origami - only play sound in same world if radius is set
+ if ( world.spigotConfig.witherSpawnSoundRadius > 0 && (player.world != this.world || distanceSquared > world.spigotConfig.witherSpawnSoundRadius * world.spigotConfig.witherSpawnSoundRadius) ) continue; // Spigot // Origami - only play sound in same world if radius is set
if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/server/ItemEnderEye.java b/src/main/java/net/minecraft/server/ItemEnderEye.java
index 0685030128..9471081851 100644
index 0685030128..eac6cd2339 100644
--- a/src/main/java/net/minecraft/server/ItemEnderEye.java
+++ b/src/main/java/net/minecraft/server/ItemEnderEye.java
@@ -42,7 +42,7 @@ public class ItemEnderEye extends Item {
double deltaX = soundPos.getX() - player.locX();
double deltaZ = soundPos.getZ() - player.locZ();
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 && player.world == world && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot // Origami - only play sound in same world if radius is set
+ if (world.spigotConfig.endPortalSoundRadius > 0 && (player.world != world || distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius)) continue; // Spigot // Origami - only play sound in same world if radius is set
if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
Expand Down

0 comments on commit f5d6cd6

Please sign in to comment.