There should be a onuse subcommand added to the execute command. Example syntax:
/execute <target: selector> <position: x y z> use <itemName: Item | all> <command: command>
When the player right clicks (or the equivalent on touchscreen/console) this command would be run. You could then specify an item that the player has to be holding, or use all to allow for any item. (Maybe an array could even be used to allow for multiple items?) Here's an example that would look for any player right clicking a nether wart and teleport them to 10, 5, 7:
/execute @a ~ ~ ~ use nether_wart tp @s 10 5 7
An example setting the block under someone to obsidian if they right click at all:
/execute @a ~ ~ ~ use all setblock ~ ~-1 ~ obsidian
Maybe even allow a ! at the front to allow all but that item (i.e. !air would allow for any item being held except air).
/execute @a ~ ~ ~ use !air say I used an item that wasn't air!
Please sign in to leave a comment.
3 Comments