Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-272924

Knockback provided by `explode` is completely blocked by solid blocks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21 Pre-Release 2, 1.21.2 Release Candidate 1, 1.21.2, 24w44a, 1.21.3, 24w45a, 24w46a
    • None
    • Community Consensus
    • Data Packs, Enchantments
    • Normal
    • Platform

      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

      1. 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
                  }
              }
          ]
      }
      ...
      1. Go in game and apply the enchantment to a bow (/enchant @s test:knockback_arrow if using the sample datapack).
      2. Summon mobs, or use yourself for testing.
      3. Shoot a solid block near a mob within the radius of the enchantment. Observe how no knockback is applied.
      4. 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.

            Unassigned Unassigned
            catter1 catter1
            Votes:
            18 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              CHK: