mojira.dev
MC-305845

Spear charge attacks don't work while riding an entity moving with an apply_impulse enchantment

using a spear charge attack while riding any entity moving with a custom enchantment using apply_impulse won’t do any damage regardless of the speed of the entity

steps to reproduce:

give a saddle with a custom “apply_impulse” enchantment like this one:

{
  "anvil_cost": 2,
  "description": {
    "translate": "impulse_test"
  },
  "max_cost": {
    "base": 1,
    "per_level_above_first": 20
  },
  "max_level": 2,
  "min_cost": {
    "base": 2,
    "per_level_above_first": 20
  },
  "slots": [
    "saddle"
  ],
  "supported_items": "minecraft:saddle",
  "weight": 1,
  "effects": {
    "minecraft:tick": [
      {
        "requirements": {
          "condition": "minecraft:entity_properties",
          "entity": "this",
          "predicate": {
            "passenger": {
              "type_specific": {
                "type": "minecraft:player",
                "input": {
                  "forward": true
                }
              }
            }
          }
        },
        "effect": {
          "type": "minecraft:apply_impulse",
          "direction": [
            0,
            0,
            1
          ],
          "coordinate_scale": [
            1,
            0,
            1
          ],
          "magnitude": 0.4
        }
      }
    ]
  }
}
{
  "anvil_cost": 2,
  "description": {
    "translate": "impulse_test"
  },
  "max_cost": {
    "base": 1,
    "per_level_above_first": 20
  },
  "max_level": 2,
  "min_cost": {
    "base": 2,
    "per_level_above_first": 20
  },
  "slots": [
    "saddle"
  ],
  "supported_items": "minecraft:saddle",
  "weight": 1,
  "effects": {
    "minecraft:tick": [
      {
        "requirements": {
          "condition": "minecraft:entity_properties",
          "entity": "this",
          "predicate": {
            "passenger": {
              "type_specific": {
                "type": "minecraft:player",
                "input": {
                  "forward": true
                }
              }
            }
          }
        },
        "effect": {
          "type": "minecraft:apply_impulse",
          "direction": [
            0,
            0,
            1
          ],
          "coordinate_scale": [
            1,
            0,
            1
          ],
          "magnitude": 0.4
        }
      }
    ]
  }
}

to make it easier to control the entity you can use this ticking command :

execute at @a run data modify entity @n[distance=..4] Rotation[0] set from entity @p Rotation[0]
execute at @a run data modify entity @n[distance=..4] Rotation[0] set from entity @p Rotation[0]

Expected result :

using a spear charge attack while riding the enchanted entity should inflict damage when you run towards an entity

Actual result :

the jab attack work as intended but the charge attack won’t work, regardless of the speed or of the mounted entity (tested with pigs and ravagers)

Environment

Minecraft Java 1.21.11

Attachments

Comments 2

Hi!
Thank you for your report! 

Could you please provide more details. As we have no repro of this issue.

  • Could you please provide datapack that the issue occurred on?

Quick Links
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

This is the datapack, to ride and control a ravager you need to craft a reinforced lead on a smithing table like this :

reinforced_lead.png

then you just need to right click on a ravager with it to apply the enchantment on the ravager, you can control it with WASD and sprint.

something I thought after reporting the bug : I was thinking the issue was related to the fact that I use

data merge entity @s {attributes:[{id:"minecraft:movement_speed",base:0}]}
data merge entity @s {attributes:[{id:"minecraft:movement_speed",base:0}]}

every tick to prevent the ravager from moving on it’s own (ravagers seems to get back their default movement_speed attribute after a tick (this is another bug)) but removing this line doesn’t affect the outcome of the test.

datapack:

[media]

nugrevan

(Unassigned)

Confirmed

Platform

Normal

Combat, Networking, Player

1.21.11

Retrieved