#Block interaction using Advancements

1 messages · Page 1 of 1 (latest)

normal jacinth
#

I am working on a small datapack that adds magic rituals to the game, I added custom blocks but I need to add interactions.
The best way to do it is with advancements, I tried it but I am using a hopper for that custom block because of its shape. I need some help with the advancements (I dont know much about these). I want to make so that when a player right clicks on a hopper (locked and has a custom name) while holding any item, then a function is executed.

dapper oxideBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1744714132:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

near abyss
#

you can use https://misode.github.io/advancement/ to generate an advancement that has a requirement with the trigger item_used_on_block then you can add conditions like which block or if there is a marker nearby. Then you can reward a function, in that function make sure to also revoke the advancement

normal jacinth
#

I do not know how advancements work, even with the datapack generator

near abyss
#

well an advancement is something you can receive by doing a certain thing, that thing is called a requirement. Each requirement can be met when the trigger happens (for example: item_used_on_block -> when an item (or an empty hand) is used on a block) and all conditions are also met. When an advancement is granted, it can also give you some rewards, these can be functions, loot_tables, xp etc..

normal jacinth
#
  "criteria": {
    "requirement": {
      "trigger": "minecraft:item_used_on_block",
      "conditions": {
        "player": [
          {
            "condition": "minecraft:inverted",
            "term": {
              "condition": "minecraft:reference",
              "name": "server:entity/sneaking_with_item"
            }
          }
        ],
        "location": [
          {
            "condition": "minecraft:location_check",
            "predicate": {
              "block": {
                "blocks": [
                  "minecraft:hopper"
                ]
              }
            }
          }
        ]
      }
    }
  },
  "rewards": {
    "function": "server:block/podium/click"
  },
  "requirements": [
    [
      "requirement"
    ]
  ]
}```
near abyss
#

The best way to learn what advancements are is to try to use them yourself and experement even if you don't know what you're doing

normal jacinth
#

I got this from a datapack

near abyss
#

I don't really understand how I should help you

#

You can't expect yourself to fully understand advancements by looking at one for 2 seconds and then asking some explanation

#

just experement with them

normal jacinth
#

okay

near abyss
#

try stuff and if it doesn't work well change smth

upper rivet
#

I think there is another trigger for it

loud tinsel
upper rivet
#

yeah that one

normal jacinth
#

What does the default block use do?

normal jacinth
#

The advancement works but only when I place a block while looking at the hopper (in the code). I want to make so that it detects any item in my hand and executes when any item is right clicked on hopper

near abyss
normal jacinth
#

exept item_used_on_block?

#

yeah but I need to have an item in my hand to do it

dapper oxideBOT
#
Closed for inactivity

This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.

dapper oxideBOT
#
Closed for inactivity

This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.