mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 04:31:58 +01:00
99 lines
3.8 KiB
Diff
99 lines
3.8 KiB
Diff
From f7b834bdab10e17a64f8bc34a000dd44ce295b40 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 1ed58f4bb..a797a5767 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -124,4 +124,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 bff44d535..6804b7274 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -461,9 +461,15 @@ 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.aa();
|
|
}
|
|
+ */
|
|
+ this.performVoidDamage();
|
|
+ // Paper end
|
|
|
|
if (!this.world.isClientSide) {
|
|
this.setFlag(0, this.fireTicks > 0);
|
|
@@ -473,6 +479,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
this.world.methodProfiler.exit();
|
|
}
|
|
|
|
+ // 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 void E() {
|
|
if (this.portalCooldown > 0) {
|
|
--this.portalCooldown;
|
|
@@ -540,6 +557,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
this.fireTicks = 0;
|
|
}
|
|
|
|
+ protected final void doVoidDamage() { this.aa(); } // Paper - OBFHELPER
|
|
protected void aa() {
|
|
this.die();
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
index 205251bcd..0f531e7d4 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
@@ -193,9 +193,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.aa();
|
|
}
|
|
+ */
|
|
+ this.performVoidDamage();
|
|
+ // Paper end
|
|
|
|
int i;
|
|
|
|
--
|
|
2.21.0
|
|
|