-3

I want to assign an item to perform a specific command that will place down a redstone block at some coordinates when I right click it. How would I do this?

0
0

You will want to use a carrot on a stick, because you can use a scoreboard to keep track of its uses (which is a right click).

Set up a scoreboard like this: scoreboard objectives add carrotClicks minecraft.used:minecraft.carrot_on_a_stick

In a repeating always active command block put execute as @a[scores={carrotClicks=1..}] run setblock <some pos> redstone_block and in a chained command block put scoreboard players set @a carrotClicks 0.

Thus, when a player right clicks with the carrot on a stick they will increase their score in the carrotClicks objective, which will cause the command block to exeucute the setblock command as that player and then reset their score back to zero. Additionally, if you wanted to execute not as the player but as the command block you can use if entity rather than as @a.

Not the answer you're looking for? Browse other questions tagged or ask your own question.