Paper/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch
Shane Freeder 298c9022b0 Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
ccb9614e #548: LivingEntity - add methods for getting/setting invisibility

CraftBukkit Changes:
f8d4da08 #743: LivingEntity - add methods for getting/setting invisibility

Spigot Changes:
17d78dbd Rebuild patches
2020-09-19 12:29:53 +01:00

89 lines
3.8 KiB
Diff

From 0000000000000000000000000000000000000000 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 d59b82b7bb1f6d1b231f4e394e0a67a3d154d7be..f7a0a33e49cadf9b2bd43f118c106937760da762 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -129,4 +129,19 @@ 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/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2d421709d9155d8112b779a077f959c60fe9dba7..e9725b99fd0ce9a104bce07425b9c049cb4b3be6 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -415,9 +415,16 @@ 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.am();
}
+ */
+ this.performVoidDamage();
+ // Paper end
if (!this.world.isClientSide) {
this.setFlag(0, this.fireTicks > 0);
@@ -510,6 +517,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.setFireTicks(0);
}
+ // Paper start
+ protected void performVoidDamage() {
+ if (this.locY() < -64.0D || (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
+ && world.paperConfig.doNetherTopVoidDamage()
+ && this.locY() >= world.paperConfig.netherVoidTopDamageHeight)) {
+ this.doVoidDamage();
+ }
+ }
+ // Paper end
+ protected final void doVoidDamage() { this.am(); } // Paper - OBFHELPER
protected void am() {
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
index 5e41e9527a966b2fa935ab5ae266cbbedf6fc114..f04e0dbe544b5dc0e40e37c4159a4f26fa149845 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -292,9 +292,15 @@ public abstract class EntityMinecartAbstract extends Entity {
this.setDamage(this.getDamage() - 1.0F);
}
+ // Paper start - Configurable nether ceiling damage
+ // Extracted to own function
+ /*
if (this.locY() < -64.0D) {
this.am();
}
+ */
+ this.performVoidDamage();
+ // Paper end
// this.doPortalTick(); // CraftBukkit - handled in postTick
if (this.world.isClientSide) {