PaperSpigot-Parent/CraftBukkit-Patches/0096-Configurable-dragon-death-and-wither-spawn-sounds.patch

55 lines
3.0 KiB
Diff
Raw Normal View History

From 02aa3cbee16d3fbe91cfa49efccc90fa45e15a07 Mon Sep 17 00:00:00 2001
From: drXor <mcyoungsota@gmail.com>
Date: Sat, 29 Mar 2014 13:44:25 -0400
Subject: [PATCH] Configurable dragon death and wither spawn sounds
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
2014-11-28 02:17:45 +01:00
index 51686c4..ec94142 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
2014-11-28 02:17:45 +01:00
@@ -572,6 +572,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
double deltaX = this.locX - player.locX;
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 (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
2014-11-28 02:17:45 +01:00
index d21c0e9..8ed2b4b 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
2014-11-28 02:17:45 +01:00
@@ -183,6 +183,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
double deltaX = this.locX - player.locX;
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 (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2014-11-28 02:17:45 +01:00
index 71f772c..7904926 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -280,4 +280,16 @@ public class SpigotWorldConfig
maxCollisionsPerEntity = getInt( "max-entity-collisions", 8 );
log( "Max Entity Collisions: " + maxCollisionsPerEntity );
}
+
+ public int dragonDeathSoundRadius;
+ private void keepDragonDeathPerWorld()
+ {
+ dragonDeathSoundRadius = getInt( "dragon-death-sound-radius", 0 );
+ }
+
+ public int witherSpawnSoundRadius;
+ private void witherSpawnSoundRadius()
+ {
+ witherSpawnSoundRadius = getInt( "wither-spawn-sound-radius", 0 );
+ }
}
--
2014-11-28 02:17:45 +01:00
2.1.0