3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/Spigot-Server-Patches/0025-Configurable-top-of-nether-void-damage.patch

92 Zeilen
3.3 KiB
Diff

2016-12-20 23:34:27 +01:00
From 66a919e1275e53a9d28c58b412e473ab6e9baa78 Mon Sep 17 00:00:00 2001
2016-03-01 00:09:49 +01:00
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
2016-11-17 03:23:38 +01:00
index 06d1527..2767ffb 100644
2016-03-01 00:09:49 +01:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
2016-11-17 03:23:38 +01:00
@@ -143,4 +143,10 @@ public class PaperWorldConfig {
2016-03-01 00:09:49 +01:00
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
2016-12-20 23:34:27 +01:00
index 537adb5..7f6d492 100644
2016-03-01 00:09:49 +01:00
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
2016-12-20 23:34:27 +01:00
@@ -394,9 +394,15 @@ public abstract class Entity implements ICommandListener {
this.fallDistance *= 0.5F;
}
+ // Paper start - Configurable nether ceiling damage
+ // Extracted to own function
+ /*
if (this.locY < -64.0D) {
this.Y();
}
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
if (!this.world.isClientSide) {
this.setFlag(0, this.fireTicks > 0);
2016-12-20 23:34:27 +01:00
@@ -406,6 +412,18 @@ public abstract class Entity implements ICommandListener {
this.world.methodProfiler.b();
2016-03-01 00:09:49 +01:00
}
+ // Paper start - Configurable top of nether void damage
2016-03-01 00:09:49 +01:00
+ 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 H() {
if (this.portalCooldown > 0) {
--this.portalCooldown;
2016-12-20 23:34:27 +01:00
@@ -462,6 +480,7 @@ public abstract class Entity implements ICommandListener {
this.fireTicks = 0;
}
+ protected final void kill() { this.Y(); } // Paper - OBFHELPER
protected void Y() {
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
2016-11-17 03:23:38 +01:00
index fdacb6d..ec75bab 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
2016-11-17 03:23:38 +01:00
@@ -206,9 +206,15 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
this.setDamage(this.getDamage() - 1.0F);
2016-03-01 00:09:49 +01:00
}
+ // Paper start - Configurable nether ceiling damage
+ // Extracted to own function
+ /*
if (this.locY < -64.0D) {
2016-03-01 00:09:49 +01:00
this.Y();
}
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
int i;
2016-03-01 00:09:49 +01:00
--
2.9.3
2016-03-01 00:09:49 +01:00