mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
63 lines
3.8 KiB
Diff
63 lines
3.8 KiB
Diff
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>
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
index 4ac7f43b834a2c761ad538f9d00afb2263ed7e4f..37dfd08621d402a339f36bb70f1b39de010e8669 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
@@ -145,6 +145,16 @@ public class FallingBlockEntity extends Entity {
|
|
++this.time;
|
|
this.applyGravity();
|
|
this.move(MoverType.SELF, this.getDeltaMovement());
|
|
+ // Paper start - Configurable falling blocks height nerf
|
|
+ if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
|
|
+ if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
|
+ this.spawnAtLocation(block);
|
|
+ }
|
|
+
|
|
+ this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD);
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - Configurable falling blocks height nerf
|
|
if (!this.level().isClientSide) {
|
|
BlockPos blockposition = this.blockPosition();
|
|
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
|
|
index e4a7d4cda22106716897df964cd74d0bbccd6092..f127cac376cf4d0e585d12cd5976a3aee567403a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -78,6 +78,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
|
if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
|
this.applyGravity();
|
|
this.move(MoverType.SELF, this.getDeltaMovement());
|
|
+ // Paper start - Configurable TNT height nerf
|
|
+ if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
|
|
+ this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD);
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - Configurable TNT height nerf
|
|
this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
|
|
if (this.onGround()) {
|
|
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
|
|
index c112c4b103c34e05f4de973eec94a969f60b085e..b7036f8399e2500ba01736c6006b972f7ca4838e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
|
|
@@ -54,6 +54,12 @@ public class MinecartTNT extends AbstractMinecart {
|
|
public void tick() {
|
|
super.tick();
|
|
if (this.fuse > 0) {
|
|
+ // Paper start - Configurable TNT height nerf
|
|
+ if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
|
|
+ this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD);
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - Configurable TNT height nerf
|
|
--this.fuse;
|
|
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
|
|
} else if (this.fuse == 0) {
|