From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ 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 int netherVoidTopDamageHeight; + public boolean doNetherTopVoidDamage() { return netherVoidTopDamageHeight > 0; } + private void netherVoidTopDamageHeight() { + netherVoidTopDamageHeight = getInt("nether-ceiling-void-damage-height", 0); + log("Top of the nether void damage height: " + netherVoidTopDamageHeight); + + if (PaperConfig.version < 18) { + boolean legacy = getBoolean("nether-ceiling-void-damage", false); + if (legacy) { + netherVoidTopDamageHeight = 128; + set("nether-ceiling-void-damage-height", netherVoidTopDamageHeight); + } + } + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s this.fallDistance *= 0.5F; } - if (this.getY() < -64.0D) { - this.outOfWorld(); + // Paper start - Configurable nether ceiling damage + + // Extracted to own function + /* + if (this.locY() < -64.0D) { + this.an(); } + */ + this.performVoidDamage(); + // Paper end if (!this.level.isClientSide) { this.setSharedFlag(0, this.remainingFireTicks > 0); @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s this.setRemainingFireTicks(0); } + // Paper start + protected void performVoidDamage() { + if (this.getY() < -64.0D || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER + && level.paperConfig.doNetherTopVoidDamage() + && this.getY() >= level.paperConfig.netherVoidTopDamageHeight)) { + this.doVoidDamage(); + } + } + // Paper end + + protected final void doVoidDamage() { this.outOfWorld(); } // Paper - OBFHELPER protected void outOfWorld() { this.remove(); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java @@ -0,0 +0,0 @@ public abstract class AbstractMinecart extends Entity { this.setDamage(this.getDamage() - 1.0F); } - if (this.getY() < -64.0D) { - this.outOfWorld(); + // Paper start - Configurable nether ceiling damage + // Extracted to own function + /* + if (this.locY() < -64.0D) { + this.an(); } + */ + this.performVoidDamage(); + // Paper end // this.doPortalTick(); // CraftBukkit - handled in postTick if (this.level.isClientSide) {