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 37f586b611
commit fab2a52fe1
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76
5 changed files with 73 additions and 33 deletions

View File

@ -1,4 +1,4 @@
From 7f3fc798c035b20cfaca5d6cffc6575ba19764a8 Mon Sep 17 00:00:00 2001
From 62b72202a06a326fb3ad80b5fcff791500bd3df1 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
@ -20,31 +20,71 @@ index 8fc2f6c..d78b688 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 8f88bc8..1b58f7d 100644
index bb9be9b..18062df 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -305,6 +305,13 @@ public abstract class Entity implements ICommandListener {
this.U();
@@ -385,9 +385,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);
@@ -397,6 +403,18 @@ public abstract class Entity implements ICommandListener {
this.world.methodProfiler.b();
}
+ /**
+ * Paper - Checks if the feature is enabled and the entity is above the nether world bedrock height
+ */
+ // 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;
+ }
+
public void U() {
this.world.methodProfiler.a("entityBaseTick");
if (this.isPassenger() && this.bB().dead) {
@@ -385,7 +392,7 @@ public abstract class Entity implements ICommandListener {
this.fallDistance *= 0.5F;
+ protected void checkAndDoHeightDamage() {
+ if (this.locY < -64.0D || paperNetherCheck()) {
+ this.kill();
+ }
+ }
+ // Paper end
+
protected void H() {
if (this.portalCooldown > 0) {
--this.portalCooldown;
@@ -453,6 +471,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
index 36ef2da..4438d83 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -210,9 +210,15 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
this.setDamage(this.getDamage() - 1.0F);
}
- if (this.locY < -64.0D) {
+ if (this.locY < -64.0D || paperNetherCheck()) { // Paper - Configurable top-of-nether void damage)
+ // Paper start - Configurable nether ceiling damage
+ // Extracted to own function
+ /*
if (this.locY < -64.0D) {
this.Y();
}
+ */
+ this.checkAndDoHeightDamage();
+ // Paper end
int i;
--
2.8.3

View File

@ -1,4 +1,4 @@
From 9567aaa67ebbdbfc570e398ba6d9a5ee7676bb59 Mon Sep 17 00:00:00 2001
From b7cbd2b9ee5b422b23f63f71139095e6ad13741b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 23:25:45 -0500
Subject: [PATCH] Disable Scoreboards for non players by default
@ -37,10 +37,10 @@ index 5f579bc..8e5419d 100644
if (scoreboard.addPlayerToTeam(s2, s)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2dfe212..f192fe5 100644
index 1764791..153fc76 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1882,6 +1882,7 @@ public abstract class Entity implements ICommandListener {
@@ -1894,6 +1894,7 @@ public abstract class Entity implements ICommandListener {
@Nullable
public ScoreboardTeamBase aQ() {

View File

@ -1,4 +1,4 @@
From b378c82821f7f7a5fee66bd12b7b861c8cd8378f Mon Sep 17 00:00:00 2001
From f914a2ed987032315fc8febb9439ae4311e75e91 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 22 Mar 2016 00:55:23 -0400
Subject: [PATCH] Don't teleport dead entities
@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic.
Potentially an old CB change that's no longer needed.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 6a1bc3a..306e9cd 100644
index 3d5a23c..3ed3732 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2132,7 +2132,7 @@ public abstract class Entity implements ICommandListener {
@@ -2144,7 +2144,7 @@ public abstract class Entity implements ICommandListener {
}
public Entity teleportTo(Location exit, boolean portal) {

View File

@ -1,14 +1,14 @@
From ba1a119f2fdbbc0b152da75993ce0f02ce6ba469 Mon Sep 17 00:00:00 2001
From 8d2082d83ba9184205d4334e34de9cb6b6a9e9f7 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 18:20:05 -0500
Subject: [PATCH] Vehicle Event Cancellation Changes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index f4a804b..b9d9fb9 100644
index eff088d..c3efc7f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1687,6 +1687,10 @@ public abstract class Entity implements ICommandListener {
@@ -1699,6 +1699,10 @@ public abstract class Entity implements ICommandListener {
}
public boolean a(Entity entity, boolean flag) {
@ -19,7 +19,7 @@ index f4a804b..b9d9fb9 100644
if (!flag && (!this.n(entity) || !entity.q(this))) {
return false;
} else {
@@ -1695,7 +1699,7 @@ public abstract class Entity implements ICommandListener {
@@ -1707,7 +1711,7 @@ public abstract class Entity implements ICommandListener {
}
this.au = entity;
@ -28,7 +28,7 @@ index f4a804b..b9d9fb9 100644
return true;
}
}
@@ -1722,12 +1726,20 @@ public abstract class Entity implements ICommandListener {
@@ -1734,12 +1738,20 @@ public abstract class Entity implements ICommandListener {
}
protected void o(Entity entity) {
@ -49,7 +49,7 @@ index f4a804b..b9d9fb9 100644
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle();
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, false)) { // Boolean not used
@@ -1750,6 +1762,8 @@ public abstract class Entity implements ICommandListener {
@@ -1762,6 +1774,8 @@ public abstract class Entity implements ICommandListener {
return;
}
// Spigot end
@ -58,7 +58,7 @@ index f4a804b..b9d9fb9 100644
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bw() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1775,16 +1789,29 @@ public abstract class Entity implements ICommandListener {
@@ -1787,16 +1801,29 @@ public abstract class Entity implements ICommandListener {
CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity n = craftn == null ? null : craftn.getHandle();
if (event.isCancelled() || n != orig) {

View File

@ -1,4 +1,4 @@
From 6eeca920de7374cfc679c530eda2858b90ba6258 Mon Sep 17 00:00:00 2001
From d070b172f6515fcefdd6d18b1b3918a54be6f39c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 22 May 2016 20:20:55 -0500
Subject: [PATCH] Optional old TNT cannon behaviors
@ -208,10 +208,10 @@ index 8530952..b50e3d6 100644
world.getServer().getPluginManager().callEvent(event);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ef97ad1..9a08388 100644
index 797e078..e21769f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -967,6 +967,12 @@ public abstract class Entity implements ICommandListener {
@@ -979,6 +979,12 @@ public abstract class Entity implements ICommandListener {
}
public boolean ak() {
@ -224,7 +224,7 @@ index ef97ad1..9a08388 100644
if (this.bB() instanceof EntityBoat) {
this.inWater = false;
} else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) {
@@ -1168,6 +1174,12 @@ public abstract class Entity implements ICommandListener {
@@ -1180,6 +1186,12 @@ public abstract class Entity implements ICommandListener {
}
public double f(double d0, double d1, double d2) {
@ -237,7 +237,7 @@ index ef97ad1..9a08388 100644
double d3 = this.locX - d0;
double d4 = this.locY - d1;
double d5 = this.locZ - d2;
@@ -1222,6 +1234,12 @@ public abstract class Entity implements ICommandListener {
@@ -1234,6 +1246,12 @@ public abstract class Entity implements ICommandListener {
}
public void g(double d0, double d1, double d2) {
@ -250,7 +250,7 @@ index ef97ad1..9a08388 100644
this.motX += d0;
this.motY += d1;
this.motZ += d2;
@@ -2340,6 +2358,12 @@ public abstract class Entity implements ICommandListener {
@@ -2352,6 +2370,12 @@ public abstract class Entity implements ICommandListener {
}
public boolean bg() {