Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Lychee Wiki › Guides › How to Make a Custom Right-Click Interaction with Lychee

How to Make a Custom Right-Click Interaction with Lychee

Setting Up the Recipe File

Lychee reads JSON recipes from a datapack, so create a folder path like data/<your_namespace>/recipes/ inside your world's datapacks folder. Each interaction is its own JSON file. The recipe type field determines which Lychee interaction you are triggering — for a right-click or use-on-block action, use the block interaction type that Lychee exposes in its recipe registry.

Defining the Trigger and Result

Inside the JSON, you specify the block that must be clicked, the item held in the player's hand, and what should happen. Typical fields include the target block, the held item (or a tag), and a list of results such as dropping items, placing a block, running a command, or damaging the tool. If you want the interaction to consume the held item, add the appropriate consume flag rather than scripting it yourself.

Testing In-Game

Reload datapacks with /reload, then right-click the target block while holding the specified item. If nothing happens, check that your namespace and file path match, that the JSON is valid, and that the block ID and item ID exist in your modpack. Use /lychee style debug commands if your build provides them, or check the game log for recipe parsing errors — Lychee reports malformed recipes there.