2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2016-03-01 00:09:49 +01:00
|
|
|
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
|
|
|
|
|
2020-12-03 07:08:20 +01:00
|
|
|
* Dec 2, 2020 Added tnt nerf for tnt minecarts - Machine_Maker
|
2016-03-01 00:09:49 +01:00
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-11-12 02:48:12 +01:00
|
|
|
index 89e76dd73811fd0f6f8c8e7e5af804d5a4bb5a75..d16ae924bcbe31c964f7fb448757c748e5c4418c 100644
|
2016-03-01 00:09:49 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-11-12 02:48:12 +01:00
|
|
|
@@ -124,4 +124,14 @@ public class PaperWorldConfig {
|
2016-03-01 00:09:49 +01:00
|
|
|
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);
|
|
|
|
+ }
|
|
|
|
}
|
2017-05-14 20:05:01 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2021-03-09 00:12:31 +01:00
|
|
|
index ae96ff73f78a514328862de86d3ecdb29fa9c145..09bab3828197e3078a4ed95e7c8a9f34e8bf1b8d 100644
|
2017-05-14 20:05:01 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2020-09-19 13:29:53 +02:00
|
|
|
@@ -1765,6 +1765,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2018-07-15 03:53:17 +02:00
|
|
|
return this.a(itemstack, 0.0F);
|
2017-05-14 20:05:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ @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()) {
|
2016-03-01 00:09:49 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2020-11-12 05:58:42 +01:00
|
|
|
index 55e6d9a94c648bac68b80a76eda041fb952db09f..6b226c04d40adff8b0f1d28c0cc79439df002b3d 100644
|
2016-03-01 00:09:49 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2020-04-08 09:49:15 +02:00
|
|
|
@@ -85,6 +85,17 @@ public class EntityFallingBlock extends Entity {
|
2019-06-16 15:47:23 +02:00
|
|
|
}
|
2016-03-01 00:09:49 +01:00
|
|
|
|
2019-06-16 15:47:23 +02:00
|
|
|
this.move(EnumMoveType.SELF, this.getMot());
|
|
|
|
+
|
|
|
|
+ // Paper start - Configurable EntityFallingBlock height nerf
|
2019-12-12 19:45:00 +01:00
|
|
|
+ if (this.world.paperConfig.fallingBlockHeightNerf != 0 && this.locY() > this.world.paperConfig.fallingBlockHeightNerf) {
|
2019-06-25 03:47:58 +02:00
|
|
|
+ if (this.dropItem && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
2019-06-16 15:47:23 +02:00
|
|
|
+ this.a(block);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.die();
|
2020-04-08 09:49:15 +02:00
|
|
|
+ return;
|
2019-06-16 15:47:23 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
if (!this.world.isClientSide) {
|
2020-06-25 11:27:25 +02:00
|
|
|
blockposition = this.getChunkCoordinates();
|
2019-06-16 15:47:23 +02:00
|
|
|
boolean flag = this.block.getBlock() instanceof BlockConcretePowder;
|
2020-12-03 07:08:20 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityMinecartTNT.java b/src/main/java/net/minecraft/server/EntityMinecartTNT.java
|
|
|
|
index 50d7c2899deb707dbbe333242e049b963d9b549c..3dfe3d13ac713c963256a662b52f54716e397672 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityMinecartTNT.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityMinecartTNT.java
|
|
|
|
@@ -26,6 +26,12 @@ public class EntityMinecartTNT extends EntityMinecartAbstract {
|
|
|
|
public void tick() {
|
|
|
|
super.tick();
|
|
|
|
if (this.b > 0) {
|
|
|
|
+ // Paper start - Configurable TNT entity height nerf
|
|
|
|
+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) {
|
|
|
|
+ this.die();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
--this.b;
|
|
|
|
this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D);
|
|
|
|
} else if (this.b == 0) {
|
2016-03-01 00:09:49 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2021-03-09 00:12:31 +01:00
|
|
|
index 7064fd8e8318797a94b5292d675992a902b681ab..914ff5b7a9787ae5e8d5b8829e6888ba2637cc26 100644
|
2016-03-01 00:09:49 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2021-03-09 00:12:31 +01:00
|
|
|
@@ -55,6 +55,12 @@ public class EntityTNTPrimed extends Entity {
|
2016-06-09 05:57:14 +02:00
|
|
|
}
|
|
|
|
|
2019-04-24 03:00:24 +02:00
|
|
|
this.move(EnumMoveType.SELF, this.getMot());
|
2016-03-01 00:09:49 +01:00
|
|
|
+ // Paper start - Configurable TNT entity height nerf
|
2019-12-12 19:45:00 +01:00
|
|
|
+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) {
|
2016-03-01 00:09:49 +01:00
|
|
|
+ this.die();
|
2020-04-08 09:49:15 +02:00
|
|
|
+ return;
|
2016-03-01 00:09:49 +01:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2019-04-24 03:00:24 +02:00
|
|
|
this.setMot(this.getMot().a(0.98D));
|
|
|
|
if (this.onGround) {
|
|
|
|
this.setMot(this.getMot().d(0.7D, -0.5D, 0.7D));
|