aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch
blob: 84c5c75ce79b4cd21a9cbef3c303535da7822cbf (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
From 449eb3fe46c8082e18636765fd22ab8a9be1b4ca 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 d3484489b..bf7af475c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -129,4 +129,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 011cf59c0..296bdfba5 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -450,9 +450,15 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
             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);
@@ -462,6 +468,18 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
         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;
@@ -518,6 +536,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
         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 a9412d4e0..1f4025486 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.18.0