testserver/CraftBukkit-Patches/0126-Configurable-dragon-de...

71 lines
3.4 KiB
Diff

From 8c8e29dbb30f6945a78a1a215a1e866421013bcf 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
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 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