From 15b8b8a5a98f77bb8e0704d419019882daa06b9a Mon Sep 17 00:00:00 2001 From: drXor 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 dbf30cb..64b0992 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 906428d..0fd0016 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java @@ -173,7 +173,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 9745982..3e6b1e6 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 ); + } } -- 1.9.1