Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 03:20:07 +01:00
147 Zeilen
6.2 KiB
Diff
147 Zeilen
6.2 KiB
Diff
From a67ca6c100a61600fa215e1b6b0872bc62ebdd4a Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach.brown@destroystokyo.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 ddff5a8..7c94d99 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 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 3ea9c92..5deeb76 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1889,6 +1889,11 @@ 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;
|
|
@@ -1900,7 +1905,16 @@ 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 a756395..720b4a7 100644
|
|
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
@@ -191,4 +191,36 @@ 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
|
|
|