Paper/Spigot-Server-Patches/0025-Configurable-top-of-nether-void-damage.patch
2017-05-14 16:06:27 -05:00

92 lines
3.3 KiB
Diff

From 145fbb067892a319be146f8d65e5b89de7f1abb2 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 62e6830aa..e524a464f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -137,4 +137,10 @@ public class PaperWorldConfig {
waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
}
+
+ 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 3dff98596..e712ab370 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -444,9 +444,15 @@ public abstract class Entity implements ICommandListener {
this.fallDistance *= 0.5F;
}
+ // Paper start - Configurable nether ceiling damage
+ // Extracted to own function
+ /*
if (this.locY < -64.0D) {
this.ac();
}
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
if (!this.world.isClientSide) {
this.setFlag(0, this.fireTicks > 0);
@@ -456,6 +462,18 @@ public abstract class Entity implements ICommandListener {
this.world.methodProfiler.b();
}
+ // Paper start - Configurable top of nether void damage
+ private boolean paperNetherCheck() {
+ return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D;
+ }
+
+ protected void checkAndDoHeightDamage() {
+ if (this.locY < -64.0D || paperNetherCheck()) {
+ this.kill();
+ }
+ }
+ // Paper end
+
protected void I() {
if (this.portalCooldown > 0) {
--this.portalCooldown;
@@ -512,6 +530,7 @@ public abstract class Entity implements ICommandListener {
this.fireTicks = 0;
}
+ protected final void kill() { this.ac(); } // Paper - OBFHELPER
protected void ac() {
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
index f4ad25dae..4b1c7ad99 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -204,9 +204,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.ac();
}
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
int i;
--
2.13.0