Paper/Spigot-Server-Patches/0026-Configurable-top-of-nether-void-damage.patch
Aikar 5b6dfb3463
NOT FINISHED!!! Current Progress on 1.13-pre7 update
This work is 100% unfinished. I am pushing it up so that we as a team
can work on this update.

Do not try to use this branch. You will fail.
2018-07-16 00:13:29 -04:00

88 lines
3.3 KiB
Diff

From 288de182d84b0380c328c4c4590c5d0a83d74a8e Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 23:58:50 -0600
Subject: [PATCH] Configurable top of nether void damage
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4da846719..a340866f3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -123,4 +123,10 @@ public class PaperWorldConfig {
if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf);
}
+
+ public boolean netherVoidTopDamage;
+ private void netherVoidTopDamage() {
+ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
+ log("Top of the nether void damage: " + netherVoidTopDamage);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2288df268..111eeeecc 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -464,9 +464,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.fallDistance *= 0.5F;
}
+ // Paper start - Configurable nether ceiling damage
+ // Extracted to own function
+ /*
if (this.locY < -64.0D) {
this.aa();
}
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
if (!this.world.isClientSide) {
this.setFlag(0, this.fireTicks > 0);
@@ -476,6 +482,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.world.methodProfiler.e();
}
+ // Paper start
+ protected void checkAndDoHeightDamage() {
+ if (this.locY < -64.0D || (this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D)) {
+ this.kill();
+ }
+ }
+ // Paper end
+
protected void E() {
if (this.portalCooldown > 0) {
--this.portalCooldown;
@@ -532,6 +546,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.fireTicks = 0;
}
+ protected final void kill() { this.aa(); } // Paper - OBFHELPER
protected void aa() {
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
index 2f4e1a280..3598998b5 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -201,9 +201,15 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
this.setDamage(this.getDamage() - 1.0F);
}
+ // Paper start - Configurable nether ceiling damage
+ // Extracted to own function
+ /*
if (this.locY < -64.0D) {
this.aa();
}
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
int i;
--
2.18.0