#is it possible to make a "use item on entity" interaction with a datapack?

1 messages · Page 1 of 1 (latest)

mighty tundra
#

like using bone on a dog to tame it, for instance. Is that the sort of thing I can add with a datapack?

celest nest
#

You can detect existing interactions, like bone on dog or nametag on most entities or any click on villager but not any arbitrary interaction, nope, that would require trickery with an interaction entity.

Also, this should probably be in #1051225367807000706 ^^

mighty tundra
#

oh ok sorry

#

hm so i am clicking on villagers tho

#

not sure why its not working

#
    "criteria": {
        "sole_criterion": {
            "trigger": "minecraft:player_interacted_with_entity",
            "conditions": {
                "entity": {
                    "type": "minecraft:villager"
                }
            }
        }
    },
    "requirements": [
        [ "sole_criterion" ]
    ],
    "rewards": {
        "function": "reset_trades:reset_villager_trades"
    }
}``` this is the advancement class, and the function is just
``` say successful```
celest nest
#

U sure that you don’t have the advancement unlocked already?

mighty tundra
#

im thinking that may be the issue as well, im going to try and remove it in the function with this now advancement revoke @p from reset_trades:used_resetting_item_on_villager

#

(also i know a datapack that does this already exists, i wanted to try and make my own)

celest nest
#

Since @s is the player running the function and from can revoke multiple advancements (if they exist)

mighty tundra
#

oh ok

#

hm ok so it is giving me the advancement the function just isnt running properly

#

is the functions folder supposed to be function or functions

celest nest
#

If you are in 1.21+ it’s function

#

In older versions it’s plural

#

Same with the advancement(s) folder for the advancement

mighty tundra
#

alright that was the issue

celest nest
#

Does the advancement show up when you try and autocomplete a command like
advancement revoke @s only

mighty tundra
#

a lot of resources arent updated yet

#

w the plurals thing

celest nest
#

Yes, it’s a rather recent change

mighty tundra
#

thank you

mighty tundra
#

hmm.. is there a way to get a reference to the entity which a player is targeting?

#

im looking at predicates

#

and what about setting variables with commands/in functions?

#

like, when i say data get entity blah blah where does it store that?