Paper/Spigot-Server-Patches/0070-Configurable-TNT-explosion-volume.patch
Byteflux bde7f6bbbd Temporarily use getDouble() internally for calls to getFloat() in Paper configs
getFloat() seems to have an issue with reading modified values and always
returns the default value instead. This needs further investigating, but
for now making it use getDouble() internally appears to resolve the issue.
2015-08-04 17:57:17 -07:00

41 lines
1.9 KiB
Diff

From 410ae1f136e532793a05d6508ab7c8629c660185 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 4 Aug 2015 17:45:00 -0700
Subject: [PATCH] Configurable TNT explosion volume
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 6617899..2763e74 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -163,7 +163,10 @@ public class Explosion {
}
public void a(boolean flag) {
- this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
+ // PaperSpigot start - Configurable TNT explosion volume.
+ float volume = source instanceof EntityTNTPrimed ? world.paperSpigotConfig.tntExplosionVolume : 4.0F;
+ this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", volume, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
+ // PaperSpigot end
if (this.size >= 2.0F && this.b) {
this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]);
} else {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 84cdb12..d16c9fe 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -402,4 +402,10 @@ public class PaperSpigotWorldConfig
{
containerUpdateTickRate = getInt( "container-update-tick-rate", 1 );
}
+
+ public float tntExplosionVolume;
+ private void tntExplosionVolume()
+ {
+ tntExplosionVolume = getFloat( "tnt-explosion-volume", 4.0F );
+ }
}
--
2.4.6.windows.1