papermc/CraftBukkit-Patches/0122-Configurable-dragon-death-and-wither-spawn-sounds.patch

71 lines
3.4 KiB
Diff
Raw Normal View History

From 7326c2d7d2432a8898a42b86406a383934023512 Mon Sep 17 00:00:00 2001
2014-04-12 04:18:37 +00:00
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
index f53b183..9a8408c 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -550,7 +550,14 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
}
if (this.bB == 1) {
- this.world.b(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ // Spigot start
+ if(this.world.spigotConfig.dragonDeathSoundRadius > 0){
+ this.world.getServer().getHandle().sendPacketNearby((int) this.locX, (int) this.locY, (int) this.locZ, this.world.spigotConfig.dragonDeathSoundRadius, this.dimension, new PacketPlayOutWorldEvent(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0, true));
+ }
+ else {
+ this.world.b(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ }
+ // Spigot end
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 99526b9..2ba0a81 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -172,7 +172,14 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit end
this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing"));
- this.world.b(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ // Spigot start
+ if(this.world.spigotConfig.witherSpawnSoundRadius > 0){
+ this.world.getServer().getHandle().sendPacketNearby((int) this.locX, (int) this.locY, (int) this.locZ, this.world.spigotConfig.witherSpawnSoundRadius, this.dimension, new PacketPlayOutWorldEvent(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0, true));
+ }
+ else {
+ this.world.b(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ }
+ // Spigot end
}
this.s(i);
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index b12a086..312fa55 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -278,4 +278,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 );
+ }
}
--
1.8.3.2