i am planning on making a xp tomes datapack, and know how to make custom items, but i do not know how to make it interactable on demand.
does anyone here know how to make something so that when you right click with it, it will run a function for example? any help would be greatly appreciated!
does anyone here know how to make something so that when you right click with it, it will run a function for example? any help would be greatly appreciated!
Create an account or sign in to comment.
4
1
If you use a carrot on a stick as your base item, you can detect with scoreboards and NBT when a player has right clicked while holding your custom item, then run some commands :D
1
If you need RCM, use carrot with stick, if you need LCM - use invisible mob which always near you eyes(hit him, and interact with scoreboard stats) - example in my chess datapack


2
That can be done by making the base item a carrot on a stick (or a warped fungus on a stick if you wanna be fancy). There's a scoreboard type that can detect when you right click with either, so you can make it so that if the value of the scoreboard changes while holding the item with a special tag, it runs a function, and it resets your score to 0
1
The easiest way is making an invisible achievement with a reward on right clicking something that you can actually interact with example crafting tables, furncaces etc