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:
@ -42,7 +42,24 @@
|
|||||||
} else {
|
} else {
|
||||||
Block block = this.blockState.getBlock();
|
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);
|
this.spawnAtLocation(worldserver, (ItemLike) block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +68,7 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlockState iblockdata = this.level().getBlockState(blockposition);
|
BlockState iblockdata = this.level().getBlockState(blockposition);
|
||||||
@@ -191,9 +203,15 @@
|
@@ -191,9 +213,15 @@
|
||||||
this.blockState = (BlockState) this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
|
this.blockState = (BlockState) this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +85,7 @@
|
|||||||
if (block instanceof Fallable) {
|
if (block instanceof Fallable) {
|
||||||
((Fallable) block).onLand(this.level(), blockposition, this.blockState, iblockdata, this);
|
((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)) {
|
} else if (this.dropItem && worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
public PrimedTnt(EntityType<? extends PrimedTnt> type, Level world) {
|
public PrimedTnt(EntityType<? extends PrimedTnt> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
@@ -94,6 +101,7 @@
|
@@ -94,10 +101,17 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
@ -29,7 +29,17 @@
|
|||||||
this.handlePortal();
|
this.handlePortal();
|
||||||
this.applyGravity();
|
this.applyGravity();
|
||||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
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);
|
this.setFuse(i);
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
@ -44,7 +54,7 @@
|
|||||||
} else {
|
} else {
|
||||||
this.updateInWaterStateAndDoFluidPushing();
|
this.updateInWaterStateAndDoFluidPushing();
|
||||||
if (this.level().isClientSide) {
|
if (this.level().isClientSide) {
|
||||||
@@ -121,7 +132,13 @@
|
@@ -121,7 +138,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void explode() {
|
private void explode() {
|
||||||
|
|||||||
@ -19,7 +19,20 @@
|
|||||||
|
|
||||||
public MinecartTNT(EntityType<? extends MinecartTNT> type, Level world) {
|
public MinecartTNT(EntityType<? extends MinecartTNT> type, Level world) {
|
||||||
super(type, 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) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
double d1 = Math.min(Math.sqrt(power), 5.0D);
|
double d1 = Math.min(Math.sqrt(power), 5.0D);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user