Fix missed case in top of nether void damage patch

General cleanup, etc.
Closes GH-343
This commit is contained in:
Zach Brown 2016-06-18 00:25:37 -05:00
parent 290af99931
commit 9127c31ed6

View file

@ -24,26 +24,66 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
this.U(); 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);
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
this.world.methodProfiler.b();
} }
+ /** + // Paper start - Configurable top of nether void damage
+ * Paper - Checks if the feature is enabled and the entity is above the nether world bedrock height
+ */
+ private boolean paperNetherCheck() { + private boolean paperNetherCheck() {
+ return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D; + return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D;
+ } + }
+ +
public void U() { + protected void checkAndDoHeightDamage() {
this.world.methodProfiler.a("entityBaseTick"); + if (this.locY < -64.0D || paperNetherCheck()) {
if (this.isPassenger() && this.bB().dead) { + this.kill();
+ }
+ }
+ // Paper end
+
protected void H() {
if (this.portalCooldown > 0) {
--this.portalCooldown;
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
this.fallDistance *= 0.5F; 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
this.setDamage(this.getDamage() - 1.0F);
} }
- if (this.locY < -64.0D) { + // Paper start - Configurable nether ceiling damage
+ if (this.locY < -64.0D || paperNetherCheck()) { // Paper - Configurable top-of-nether void damage) + // Extracted to own function
+ /*
if (this.locY < -64.0D) {
this.Y(); this.Y();
} }
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
int i;
-- --