The Bug:
Boats and armor stands are not destroyed by falling anvils.
Please note that marker armor stands aren't supposed to be destroyed with falling anvils as stated in this comment by [Mojang] Brandon Pearce.
Steps to Reproduce:
Build the setup as shown in the attachment below. setup.png
Place an anvil on the diamond blocks above the armor stand and boat, so that they would fall onto them.
As the anvils lands, take note as to whether or not the armor stand or boat was destroyed from the falling anvil.
Observed Behavior:
Boats and armor stands are not destroyed by falling anvils. If you drop an anvil on a minecart, it breaks.
If you drop an anvil on a boat/armor stand, the anvil does not break it,
They all should act in the same way. It's weird how wooden objects are immune to anvil drops, when metal minecarts aren't.
Expected Behavior:
Boats and armor stands would be destroyed by falling anvils.
Attachments
Comments 23
Anvils and falling dripstone are not intended to work the same, so please separate these. Also, falling dripstone is only supposed damage living entities.
Before I bore you to death, the armor stand is not affected by the following bug. Armor stands have an interesting damage() override which causes many problems. Head over to my other code analysis in MC-199210 for more info on that.
The bug I will be talking about here is the bounding box of the falling block not being recalculated at the proper position due to the boat's hard hitbox.
So for this specific bug, I'm not going to provide the code analysis explaining why the falling blocks bounding box is offset since that would take me an hour to write down every important piece of code instead let me explain why it happens.
Firstly the falling block is a normal entity so it does collisions the same as every other entity. Boats have a hard hitbox like shulkers, so entities upon colliding with them will offset their bounding box to be on top of them instead of inside of them.
Code Analysis (Yarn - 22w15a)
net.minecraft.entity.FallingBlockEntity.java
public boolean handleFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
// ...
float f = (float)Math.min(MathHelper.floor((float)i * this.fallHurtAmount), this.fallHurtMax);
this.world.getOtherEntities(this, this.getBoundingBox(), predicate).forEach(entity ->
entity.damage(damageSource2, f)
);
// ...
}
The important part above is this.getBoundingBox()
as I've explained before, the bounding box of the falling block entities sits above the hard hitbox so the boat does not get damaged due to the hitbox being used.
The way to fix this is very simple, you simply recalculate the bounding box at the falling blocks last blockPos (current blockPos).
Discovered while testing MC-200901