I'm trying to make a data pack with custom items in it but I can't figure out how to detect if someone is hit by an item with a Custom Model Data. I have tried using an advancement, but it seems to make it so whenever I hit someone in general, not just with a stick.

If somebody could find out what's going on I'll be pretty thankful, even if they can't make it for only a stick with a custom model data.

This is the advancement I have currently:

  • 3
    Welcome to Arqade! It's better if you paste your code, and not a screenshot of it
    – pinckerman
    Feb 17, 2022 at 21:03

1 Answer 1


Something to the effect of this?

  "criteria": {
    "requirement": {
      "trigger": "minecraft:entity_hurt_player",
      "conditions": {
        "damage": {
          "source_entity": {
            "type": "minecraft:player",
            "nbt": "{CustomModelData:101}",
            "team": "Yo"

So the player requirement means it only works if you are hit by a player. If you want it to work for mobs too, you can remove that requirement.

I think putting your custom model nbt in the nbt requirement should make it work, but if not you can also have a separate command running to execute as all players holding an item matching that nbt (which I can paste if you need it) and have them join a team. The team check would also trigger when anyone on that team hits you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .