Fix out of bounds falling block removal (#2188)

This commit is contained in:
Shane Freeder 2019-06-16 14:47:23 +01:00
parent edaba19eb0
commit 84d6850443
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C
3 changed files with 27 additions and 24 deletions

View file

@ -1,4 +1,4 @@
From e24824ad9e290cc0f08b3bcc12ae79aecac2e19c Mon Sep 17 00:00:00 2001
From 72c9924c43d2d39544698b14e6332ce719556754 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 14:14:15 -0600
Subject: [PATCH] Drop falling block and tnt entities at the specified height
@ -36,23 +36,26 @@ index c348d6bec3..f5647a171d 100644
public EntityItem a(ItemStack itemstack, float f) {
if (itemstack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index c9c903367f..55591fbe05 100644
index c9c903367f..fee5e67877 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -105,11 +105,13 @@ public class EntityFallingBlock extends Entity {
@@ -88,6 +88,16 @@ public class EntityFallingBlock extends Entity {
}
if (!this.onGround && !flag1) {
if (!this.world.isClientSide && (this.ticksLived > 100 && (blockposition.getY() < 1 || blockposition.getY() > 256) || this.ticksLived > 600)) {
+ if (this.world.paperConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperConfig.fallingBlockHeightNerf) { // Paper - Configurable EntityFallingBlock height nerf
if (this.dropItem && this.world.getGameRules().getBoolean("doEntityDrops")) {
this.a((IMaterial) block);
}
this.die();
+ } // Paper
}
} else {
IBlockData iblockdata = this.world.getType(blockposition);
this.move(EnumMoveType.SELF, this.getMot());
+
+ // Paper start - Configurable EntityFallingBlock height nerf
+ if (this.world.paperConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperConfig.fallingBlockHeightNerf) {
+ if (this.dropItem && this.world.getGameRules().getBoolean("doEntityDrops")) {
+ this.a(block);
+ }
+
+ this.die();
+ }
+ // Paper end
if (!this.world.isClientSide) {
blockposition = new BlockPosition(this);
boolean flag = this.block.getBlock() instanceof BlockConcretePowder;
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index ba86a07344..e3001570f9 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@ -70,5 +73,5 @@ index ba86a07344..e3001570f9 100644
if (this.onGround) {
this.setMot(this.getMot().d(0.7D, -0.5D, 0.7D));
--
2.21.0
2.22.0

View file

@ -1,4 +1,4 @@
From 36f684d903c17943367b9f6066c016f0420bb2ac Mon Sep 17 00:00:00 2001
From fcf34927ee0a09db8755a8bff558a72be6a2d624 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] Entity Origin API
@ -51,10 +51,10 @@ index f5647a171d..205376f6af 100644
NBTTagList nbttaglist = new NBTTagList();
double[] adouble1 = adouble;
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 55591fbe05..90becdfdec 100644
index a4984aa9a8..23a1f8c77c 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -245,6 +245,14 @@ public class EntityFallingBlock extends Entity {
@@ -253,6 +253,14 @@ public class EntityFallingBlock extends Entity {
this.block = Blocks.SAND.getBlockData();
}
@ -134,5 +134,5 @@ index a98f6f3389..d1d37c06bf 100644
+ // Paper end
}
--
2.21.0
2.22.0

View file

@ -1,4 +1,4 @@
From ffccbcb8c8afcf5bc46ccd7bf4c1220e450eb1ec Mon Sep 17 00:00:00 2001
From 534f1cf5c45d4d413c99733210dd85860caf7934 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 12 Nov 2016 23:25:22 -0600
Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items
@ -30,10 +30,10 @@ index eed454bf40..4892113a15 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 90becdfdec..f54887e5e8 100644
index 23a1f8c77c..a86dd55292 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -224,6 +224,15 @@ public class EntityFallingBlock extends Entity {
@@ -232,6 +232,15 @@ public class EntityFallingBlock extends Entity {
@Override
protected void a(NBTTagCompound nbttagcompound) {
this.block = GameProfileSerializer.d(nbttagcompound.getCompound("BlockState"));
@ -50,5 +50,5 @@ index 90becdfdec..f54887e5e8 100644
if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) {
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");
--
2.21.0
2.22.0