From b7109efd8179d03cd5d21a03c4f1ce01ddbdccad Mon Sep 17 00:00:00 2001 From: Zach Brown 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 991a972..1a194e7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -144,4 +144,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 fd3983f..b3c29ca 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -299,6 +299,13 @@ public abstract class Entity implements ICommandListener { this.U(); } + /** + * Paper - Checks if the feature is enabled and the entity is above the nether world bedrock height + */ + private boolean paperNetherCheck() { + return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D; + } + public void U() { this.world.methodProfiler.a("entityBaseTick"); if (this.isPassenger() && this.by().dead) { @@ -379,7 +386,7 @@ public abstract class Entity implements ICommandListener { this.fallDistance *= 0.5F; } - if (this.locY < -64.0D) { + if (this.locY < -64.0D || paperNetherCheck()) { // Paper - Configurable top-of-nether void damage) this.Y(); } -- 2.7.3