Configurable nerf for TNT cannons

This commit is contained in:
Zach Brown 2014-07-09 17:40:03 -05:00
parent 56c2ba6437
commit 832f7ad2c3

View File

@ -0,0 +1,49 @@
From 135f73c937672e6d5ee4055d1c0274a84b1f27ed Mon Sep 17 00:00:00 2001
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 13cbc79..a99b962 100644
--- 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