aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0029-Configurable-top-of-nether-void-damage.patch
blob: 04abd015abf07a4eb9cb4a6d5c7d628d9f6b40eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 70bcd7cae2777c2c7fbf995b8783ece31d9349e5..0ba54e24944c9e30bc06dc2556e9c856d2b335bc 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -185,4 +185,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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ae6c1abe1443f3758fce35a20387f0ed93748af5..2f35ce076a468ac260e28ba90ac55f7717ee1b13 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -648,7 +648,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
     }
 
     public void checkOutOfWorld() {
-        if (this.getY() < (double) (this.level.getMinBuildHeight() - 64)) {
+        // Paper start - Configurable nether ceiling damage
+        if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
+            && level.paperConfig.doNetherTopVoidDamage()
+            && this.getY() >= this.level.paperConfig.netherVoidTopDamageHeight)) {
+            // Paper end
             this.outOfWorld();
         }