Paper/Spigot-Server-Patches/0025-Configurable-nerf-for-TNT-cannons.patch

50 lines
1.9 KiB
Diff
Raw Normal View History

From 7157550a84f45bb3e4d87f417585e46699aacf2a Mon Sep 17 00:00:00 2001
2014-07-10 00:40:03 +02:00
From: Zach Brown <Zbob750@live.com>
Date: Wed, 9 Jul 2014 17:38:48 -0500
Subject: [PATCH] Configurable nerf for TNT cannons
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 8ca4300..3be3d98 100644
2014-07-10 00:40:03 +02:00
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+import org.github.paperspigot.PaperSpigotWorldConfig;
public class EntityTNTPrimed extends Entity {
@@ -56,6 +57,12 @@ public class EntityTNTPrimed extends Entity {
this.motY *= -0.5D;
}
+ // PaperSpigot start - Configurable nerf for TNT cannons
+ if (this.locY > PaperSpigotWorldConfig.tntHeightNerf && PaperSpigotWorldConfig.tntHeightNerf != 0) {
+ this.die();
+ }
+ // PaperSpigot end
+
if (this.fuseTicks-- <= 0) {
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
if (!this.world.isStatic) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 39bbd62..0d388af 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -169,4 +169,10 @@ public class PaperSpigotWorldConfig
keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
}
+
+ public static double tntHeightNerf;
+ private void tntHeightNerf()
+ {
+ tntHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
+ }
}
--
1.9.1