2016-03-01 00:23:45 +00:00
|
|
|
From 75151f1551fd4bf5fbc99d84ce782a9f21758cd6 Mon Sep 17 00:00:00 2001
|
2014-07-21 20:46:54 +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
|
2016-02-29 21:33:06 +00:00
|
|
|
index 0643672..cc548fc 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -497,7 +497,24 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.bF == 1) {
|
|
|
|
- this.world.a(1028, new BlockPosition(this), 0);
|
|
|
|
+ // CraftBukkit start - Use relative location for far away sounds
|
|
|
|
+ // this.world.a(1028, new BlockPosition(this), 0);
|
|
|
|
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
|
|
|
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
|
|
|
+ double deltaX = this.locX - player.locX;
|
|
|
|
+ double deltaZ = this.locZ - player.locZ;
|
|
|
|
+ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
2014-07-21 20:46:54 +00:00
|
|
|
+ if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot
|
2016-02-29 21:33:06 +00:00
|
|
|
+ if (distanceSquared > viewDistance * viewDistance) {
|
|
|
|
+ double deltaLength = Math.sqrt(distanceSquared);
|
|
|
|
+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
|
|
|
+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance;
|
|
|
|
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) relativeX, (int) this.locY, (int) relativeZ), 0, true));
|
|
|
|
+ } else {
|
|
|
|
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0, true));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-21 20:46:54 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
|
2016-02-29 21:33:06 +00:00
|
|
|
index 76b6718..6b4dbb8 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityWither.java
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -202,6 +202,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
2014-07-21 20:46:54 +00:00
|
|
|
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
|
2016-02-29 21:33:06 +00:00
|
|
|
index 19525eb..79a3124 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -231,4 +231,16 @@ public class SpigotWorldConfig
|
2014-07-21 20:46:54 +00:00
|
|
|
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 );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2016-02-29 21:33:06 +00:00
|
|
|
2.5.0
|
2014-07-21 20:46:54 +00:00
|
|
|
|