PaperMC/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch
Shane Freeder 54dd19b818
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
18cda936 Fix variant of unloadChunkRequest that was incorrectly never deprecated
00763e1b Deprecate some methods
35a83d54 SPIGOT-4572: Make default no permission message clearer
6163343d Fix some misplaced material enum entries
8736469c Fix typo in TechnicalPiston documentation

CraftBukkit Changes:
0c715b32 SPIGOT-4579: Shulker boxes not dropping in creative
50fbc3f1 SPIGOT-4576: Fix attributes in itemstack internal data being lost
8059a937 SPIGOT-4577: Fix loss of int/double custom tags when serialized to yaml
07e504c3 Clarify exception thrown when setting drop chance for player inventory
98b862ad Fix duplicate iron golem add
843cee65 Fix a bunch of duplicate EntityCombustEvent calls
43855624 SPIGOT-4571: EntityCombustEvent not firing for phantoms
2019-01-15 21:12:19 +00:00

80 lines
3.7 KiB
Diff

From 320dd5815173fe4d72fc4cdf0477f3fb46b9e86c 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
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3f734327c0..1ed58f4bba 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -114,4 +114,14 @@ public class PaperWorldConfig {
keepSpawnInMemory = getBoolean("keep-spawn-loaded", true);
log("Keep spawn chunk loaded: " + keepSpawnInMemory);
}
+
+ public int fallingBlockHeightNerf;
+ public int entityTNTHeightNerf;
+ private void heightNerfs() {
+ fallingBlockHeightNerf = getInt("falling-block-height-nerf", 0);
+ entityTNTHeightNerf = getInt("tnt-entity-height-nerf", 0);
+
+ if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
+ if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e329c2f48a..2b4a784e4d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1879,6 +1879,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.a(itemstack, 0.0F);
}
+ @Nullable public final EntityItem dropItem(ItemStack itemstack, float offset) { return this.a(itemstack, offset); } // Paper - OBFHELPER
@Nullable
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 4e4c8cc501..a6eae266de 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -86,6 +86,17 @@ public class EntityFallingBlock extends Entity {
}
this.move(EnumMoveType.SELF, this.motX, this.motY, this.motZ);
+
+ // 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.dropItem(new ItemStack(block), 0.0F);
+ }
+
+ 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 3977498c4b..5dc52b6b89 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -57,6 +57,13 @@ public class EntityTNTPrimed extends Entity {
}
this.move(EnumMoveType.SELF, this.motX, this.motY, this.motZ);
+
+ // Paper start - Configurable TNT entity height nerf
+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY > this.world.paperConfig.entityTNTHeightNerf) {
+ this.die();
+ }
+ // Paper end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
--
2.20.1