This bug is about the knockback created by the explode
entity effect used in enchantment components, also affecting the knockback_multiplier
field by proxy. Specifically, this issue can occur when explode
is used in the hit_block
component, with a projectile such as an arrow.
The Bug
The explode
entity effect is supposed to provide a knockback within the radius
of the explosion, scaled by knockback_multiplier
. However, if this explosion originates in a solid block (which can happen when an arrow hits the block), then the block will completely eat the knockback suppsoed to be provided by the explosion. This assumes the usage of block_interaction
set to none
or trigger
, which would not break the block.
Steps to Reproduce
Create a datapack with a custom bow/crossbow enchantment that applies an explosion when the arrow hits the block. See the codeblock below for an example
hit_block
component. Alternatively, use the datapack I have already created and attached to this report.
...
"effects": {
"minecraft:hit_block": [
{
"effect": {
"type": "minecraft:explode",
"radius": 4,
"block_interaction": "none",
"small_particle": {
"type": "minecraft:explosion"
},
"large_particle": {
"type": "minecraft:explosion"
},
"sound": "entity.cat.hurt",
"knockback_multiplier": 3,
"attribute_to_user": true,
"create_fire": false
}
}
]
}
...
Go in game and apply the enchantment to a bow ({{/enchant @s test:knockback_arrow}} if using the sample datapack).
Summon mobs, or use yourself for testing.
Shoot a solid block near a mob within the radius of the enchantment. Observe how no knockback is applied.
Shoot a non-solid block near a mob within the radius of the enchantment, such as a fencepost. Observe that the knockback is properly applied.
A video of the process has also been attached to this report.
Expected Behavior
Regardless if the arrow (or other projectile where applicable) hits a solid or non-solid block, knockback should be applied. As an extra note, if the optional damage_type
field is provided with the enchantment, you will notice a little bit of knockback. This is simply due to the default knockback taken from damage in general, rather than the actual knockback expected to be taken from an explosion.
Can confirm.
This even happens when the
block_interaction
is set such that the block is destroyed (probably because the knockback is calculated first).Apparently this bug first appeared in 24w21a and didn't happen in earlier snapshots.