Drop falling block and tnt entities at the specified height

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Byteflux
2016-03-01 14:14:15 -06:00
parent a24a98199a
commit 560b13ca08
3 changed files with 47 additions and 7 deletions

View File

@@ -19,7 +19,20 @@
public MinecartTNT(EntityType<? extends MinecartTNT> type, Level world) {
super(type, world);
@@ -117,8 +122,16 @@
@@ -51,6 +56,12 @@
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) {
@@ -117,8 +128,16 @@
if (world instanceof ServerLevel worldserver) {
double d1 = Math.min(Math.sqrt(power), 5.0D);