Paper/patches/server/0025-Drop-falling-block-and-tnt-entities-at-the-specified.patch

63 lines
3.4 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 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
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
2023-06-07 20:31:32 +02:00
index da6e806288cf3afc2c72228844d1d05eee8324a5..2905556cbb4715b0dcbaab54222e76669ce0e81d 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
2023-06-07 20:31:32 +02:00
@@ -140,6 +140,16 @@ public class FallingBlockEntity extends Entity {
2021-06-11 14:02:28 +02:00
}
this.move(MoverType.SELF, this.getDeltaMovement());
+ // Paper start - Configurable EntityFallingBlock height nerf
+ if (this.level.paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
2021-06-11 14:02:28 +02:00
+ if (this.dropItem && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
+ this.spawnAtLocation(block);
+ }
+
2021-06-12 00:37:16 +02:00
+ this.discard();
2021-06-11 14:02:28 +02:00
+ return;
+ }
+ // Paper end
2023-06-07 20:31:32 +02:00
if (!this.level().isClientSide) {
2022-03-01 06:43:03 +01:00
BlockPos blockposition = this.blockPosition();
2021-06-11 14:02:28 +02:00
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
2023-06-07 20:31:32 +02:00
index 320966e6e55dad3a96fee25fe0f69135d86ee8bc..c1a1b320a6f2a97e8d51a3e8fac624243603e368 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
2023-03-14 19:05:23 +01:00
@@ -66,6 +66,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
2021-06-11 14:02:28 +02:00
}
this.move(MoverType.SELF, this.getDeltaMovement());
+ // Paper start - Configurable TNT entity height nerf
+ if (this.level.paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
2021-06-12 00:37:16 +02:00
+ this.discard();
2021-06-11 14:02:28 +02:00
+ return;
+ }
+ // Paper end
this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
2023-06-07 20:31:32 +02:00
if (this.onGround()) {
2021-06-11 14:02:28 +02:00
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D));
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
2023-06-07 20:31:32 +02:00
index 137f9052701c5b10ff03b01316ced37220dbf280..ca61c84cffb4ed80281bbc587f882840964ac92d 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
2023-03-14 19:05:23 +01:00
@@ -53,6 +53,12 @@ public class MinecartTNT extends AbstractMinecart {
2021-06-11 14:02:28 +02:00
public void tick() {
super.tick();
if (this.fuse > 0) {
+ // Paper start - Configurable TNT entity height nerf
+ if (this.level.paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
2021-06-12 00:37:16 +02:00
+ this.discard();
2021-06-11 14:02:28 +02:00
+ return;
+ }
+ // Paper end
--this.fuse;
2023-06-07 20:31:32 +02:00
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
2021-06-11 14:02:28 +02:00
} else if (this.fuse == 0) {