PaperSpigot TNT Changes

Brought our multiple TNT change patches into a single patch and
configuraiton section.
You /will/ need to update your configs, sorry.

Adds additional configuration and features as well.
This commit is contained in:
Zach Brown 2015-02-23 15:03:10 -06:00
parent 390839a207
commit 78487dca8c
13 changed files with 168 additions and 117 deletions

View file

@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) {
+ this(loc, world);
this.setPosition(d0, d1, d2);
//float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); // PaperSpigot - Fix directional TNT bias
float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {

View file

@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 28 Nov 2014 02:36:18 -0600
Subject: [PATCH] Center TNT grid sample points
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
double d1 = 1.0D / ((axisalignedbb.e - axisalignedbb.b) * 2.0D + 1.0D);
double d2 = 1.0D / ((axisalignedbb.f - axisalignedbb.c) * 2.0D + 1.0D);
+ // PaperSpigot start - Center TNT sample points for more accurate calculations
+ // Shift the sample points so they are centered on the BB
+ double xOffset = (1.0 - Math.floor(1.0 / d0) * d0) / 2.0;
+ double zOffset = (1.0 - Math.floor(1.0 / d2) * d2) / 2.0;
+ // PaperSpigot end
+
if (d0 >= 0.0D && d1 >= 0.0D && d2 >= 0.0D) {
int i = 0;
int j = 0;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1;
double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2;
- if (this.rayTrace(new Vec3D(d3, d4, d5), vec3d) == null) {
+ if (this.rayTrace(new Vec3D(xOffset, d4, zOffset + d5), vec3d) == null) { // PaperSpigot - Center TNT sample points
++i;
}
--
1.9.5.msysgit.0

View file

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sat, 29 Nov 2014 23:05:52 -0800
Subject: [PATCH] Configurable TNT water movement
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
public float getHeadHeight() {
return 0.0F;
}
+
+ /**
+ * PaperSpigot - Configurable TNT water movement
+ */
+ @Override
+ public boolean aK() {
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
}
+
+ public boolean tntMovesInWater;
+ private void tntMovesInWater()
+ {
+ tntMovesInWater = getBoolean("tnt-moves-in-water", true );
+ }
}
--
1.9.5.msysgit.0

View file

@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
log( "TNT/Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
log( "Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
}
}
+

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Thu, 29 Jan 2015 15:11:31 -0600
Date: Mon, 23 Feb 2015 14:57:28 -0600
Subject: [PATCH] Configurable top of nether void damage
@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
tntMovesInWater = getBoolean("tnt-moves-in-water", true );
boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
}
+
+ public boolean netherVoidTopDamage;

View file

@ -36,13 +36,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
}
+
+ public double fallingBlockHeightNerf;
+ public int fallingBlockHeightNerf;
+ private void fallingBlockheightNerf()
+ {
+ // Technically a little disingenuous as it applies to all falling blocks but alas, backwards compat prevails!
+ fallingBlockHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
+ fallingBlockHeightNerf = getInt( "falling-block-height-nerf", 0 );
+ if (fallingBlockHeightNerf != 0) {
+ log( "TNT/Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
+ log( "Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
+ }
+ }
}

View file

@ -22,4 +22,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void setCarried(IBlockData iblockdata) {
--
--
1.9.5.msysgit.0

View file

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Fri, 11 Jul 2014 03:54:06 -0500
Subject: [PATCH] Fix directional TNT bias
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
this(world);
this.setPosition(d0, d1, d2);
- float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
+ //float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); // PaperSpigot - Fix directional TNT bias
- this.motX = (double) (-((float) Math.sin((double) f)) * 0.02F);
+ this.motX = 0; // PaperSpigot - Fix directional TNT bias //(double) (-((float) Math.sin((double) f)) * 0.02F);
this.motY = 0.20000000298023224D;
- this.motZ = (double) (-((float) Math.cos((double) f)) * 0.02F);
+ this.motZ = 0; // PaperSpigot - Fix directional TNT bias //(double) (-((float) Math.cos((double) f)) * 0.02F);
this.fuseTicks = 80;
this.lastX = d0;
this.lastY = d1;
--
1.9.5.msysgit.0

View file

@ -211,4 +211,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
{
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
+ ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
--
--
1.9.5.msysgit.0

View file

@ -0,0 +1,146 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 23 Feb 2015 15:54:17 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -0,0 +0,0 @@ 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() {}
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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
}
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
public float getHeadHeight() {
return 0.0F;
}
+
+ /**
+ * PaperSpigot - Configurable TNT water movement
+ */
+ @Override
+ public boolean aK() {
+ return world.paperSpigotConfig.tntMovesInWater;
+ }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
double d1 = 1.0D / ((axisalignedbb.e - axisalignedbb.b) * 2.0D + 1.0D);
double d2 = 1.0D / ((axisalignedbb.f - axisalignedbb.c) * 2.0D + 1.0D);
+ // PaperSpigot start - Fix TNT directional bias
+ double xOffset = (1.0 - Math.floor(1.0 / d0) * d0) / 2.0;
+ double zOffset = (1.0 - Math.floor(1.0 / d2) * d2) / 2.0;
+ // PaperSpigot end
+
if (d0 >= 0.0D && d1 >= 0.0D && d2 >= 0.0D) {
int i = 0;
int j = 0;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1;
double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2;
- if (this.rayTrace(new Vec3D(d3, d4, d5), vec3d) == null) {
+ // PaperSpigot start - Fix TNT directional bias
+ Vec3D vec3d1;
+ if (this.paperSpigotConfig.fixTNTDirectionBias) {
+ vec3d1 = new Vec3D(xOffset, d4, zOffset + d5);
+ } else {
+ vec3d1 = new Vec3D(d3, d4, d5);
+ }
+
+ if (this.rayTrace(vec3d1, vec3d) == null) {
+ // PaperSpigot end
++i;
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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> and Jedediah Smith <jedediah@silencegreys.com>
+ 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.5.msysgit.0

View file

@ -170,4 +170,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public InetSocketAddress getAddress() {
--
--
1.9.5.msysgit.0

View file

@ -686,4 +686,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
static void readConfig(Class<?> clazz, Object instance)
--
--
1.9.5.msysgit.0

View file

@ -18,4 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public CrashReport b(CrashReport crashreport) {
--
--
1.9.5.msysgit.0