Paper/Spigot-Server-Patches/0038-PaperSpigot-TNT-Changes.patch

112 Zeilen
4.5 KiB
Diff

From 6f6ad58d8f5db70d6968bef9d6dc604381ca85ad Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 8 Mar 2015 04:52:37 -0500
Subject: [PATCH] PaperSpigot TNT Changes
PaperSpigot communal TNT modification patch
Original authors for individual changes are listed w/in PaperSpigotWorldConfig
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 1daba4e..dd1ad68 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -36,6 +36,12 @@ public class EntityTNTPrimed extends Entity {
this.lastY = d1;
this.lastZ = d2;
this.source = entityliving;
+
+ // PaperSpigot start - Fix TNT directional bias
+ if (this.world.paperSpigotConfig.fixTNTDirectionBias) {
+ this.motX = this.motZ = 0;
+ }
+ // PaperSpigot end
}
protected void h() {}
@@ -63,6 +69,12 @@ public class EntityTNTPrimed extends Entity {
}
// PaperSpigot end
+ // PaperSpigot start - Configurable TNT Height Limit
+ if (this.world.paperSpigotConfig.tntHeightLimit != 0 && this.locY > this.world.paperSpigotConfig.tntHeightLimit) {
+ this.die();
+ }
+ // PaperSpigot end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
@@ -97,7 +109,15 @@ public class EntityTNTPrimed extends Entity {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
+ // PaperSpigot start - Configurable legacy TNT explosion height
+ double locY = this.locY;
+
+ if (!this.world.paperSpigotConfig.legacyTNTExplosionHeight) {
+ locY += this.length / 2.0F;
+ }
+
+ this.world.createExplosion(this, this.locX, locY, this.locZ, event.getRadius(), event.getFire(), true);
+ // PaperSpigot end
}
// CraftBukkit end
}
@@ -132,4 +152,12 @@ public class EntityTNTPrimed extends Entity {
public float getHeadHeight() {
return 0.0F;
}
+
+ /**
+ * PaperSpigot - Configurable TNT water movement
+ */
+ @Override
+ public boolean aL() {
+ return world.paperSpigotConfig.tntMovesInWater;
+ }
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index a6d8532..1915a7c 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -192,4 +192,35 @@ public class PaperSpigotWorldConfig
{
netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
}
+
+ public boolean fixTNTDirectionBias;
+ public boolean tntMovesInWater;
+ public boolean legacyTNTExplosionHeight;
+ public int tntHeightLimit;
+ private void tntChanges()
+ {
+ // Original Authors: Iceee <andrew@opticgaming.tv>
+ fixTNTDirectionBias = getBoolean( "tnt-gameplay.fix-directional-bias", false );
+ // Original Author: Byteflux <byte@byteflux.net>
+ tntMovesInWater = getBoolean( "tnt-gameplay.moves-in-water", true );
+ // Original Author: Byteflux <byte@byteflux.net>
+ legacyTNTExplosionHeight = getBoolean( "tnt-gameplay.legacy-explosion-height", false );
+ // Original Author: Somebody \o/
+ tntHeightLimit = getInt( "tnt-gameplay.tnt-entity-height-limit", 0 );
+
+ log( "Fix TNT directional bias: " + fixTNTDirectionBias );
+ log( "TNT moves in water: " + tntMovesInWater );
+ log( "Use legacy TNT explosion height " + legacyTNTExplosionHeight );
+ if ( tntHeightLimit != 0 ) {
+ log( "TNT height limit set at " + tntHeightLimit );
+ } else {
+ log( "TNT height limit disabled" );
+ }
+ if (PaperSpigotConfig.version < 7) {
+ System.err.println( "==========================================" );
+ System.err.println( " Many TNT Related Settings Have Moved " );
+ System.err.println( " Please check your config in paper.yml! " );
+ System.err.println( "==========================================" );
+ }
+ }
}
--
1.9.1