mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
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:
parent
a24a98199a
commit
560b13ca08
3 changed files with 47 additions and 7 deletions
|
@ -42,7 +42,24 @@
|
|||
} else {
|
||||
Block block = this.blockState.getBlock();
|
||||
|
||||
@@ -174,7 +186,7 @@
|
||||
@@ -147,6 +159,16 @@
|
||||
this.applyGravity();
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.applyEffectsFromBlocks();
|
||||
+ // Paper start - Configurable falling blocks height nerf
|
||||
+ if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
|
||||
+ if (this.dropItem && this.level() instanceof final ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
+ this.spawnAtLocation(serverLevel, block);
|
||||
+ }
|
||||
+
|
||||
+ this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - Configurable falling blocks height nerf
|
||||
this.handlePortal();
|
||||
Level world = this.level();
|
||||
|
||||
@@ -174,7 +196,7 @@
|
||||
this.spawnAtLocation(worldserver, (ItemLike) block);
|
||||
}
|
||||
|
||||
|
@ -51,7 +68,7 @@
|
|||
}
|
||||
} else {
|
||||
BlockState iblockdata = this.level().getBlockState(blockposition);
|
||||
@@ -191,9 +203,15 @@
|
||||
@@ -191,9 +213,15 @@
|
||||
this.blockState = (BlockState) this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
|
||||
}
|
||||
|
||||
|
@ -68,7 +85,7 @@
|
|||
if (block instanceof Fallable) {
|
||||
((Fallable) block).onLand(this.level(), blockposition, this.blockState, iblockdata, this);
|
||||
}
|
||||
@@ -221,19 +239,19 @@
|
||||
@@ -221,19 +249,19 @@
|
||||
}
|
||||
}
|
||||
} else if (this.dropItem && worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
public PrimedTnt(EntityType<? extends PrimedTnt> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -94,6 +101,7 @@
|
||||
@@ -94,10 +101,17 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
@ -29,7 +29,17 @@
|
|||
this.handlePortal();
|
||||
this.applyGravity();
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
@@ -107,10 +115,13 @@
|
||||
this.applyEffectsFromBlocks();
|
||||
+ // 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));
|
||||
@@ -107,10 +121,13 @@
|
||||
|
||||
this.setFuse(i);
|
||||
if (i <= 0) {
|
||||
|
@ -44,7 +54,7 @@
|
|||
} else {
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.level().isClientSide) {
|
||||
@@ -121,7 +132,13 @@
|
||||
@@ -121,7 +138,13 @@
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue