Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Lychee Wiki › Guides › Creating an Anvil Crafting Recipe in Lychee

Creating an Anvil Crafting Recipe in Lychee

Why Use Lychee for Anvil Recipes

Vanilla anvil behavior is limited to repairing and renaming. Lychee lets you define custom anvil interactions through JSON, so you can turn an anvil into a crafting station for your modpack without writing Java. This is useful for gating recipes behind an XP cost or requiring a specific input item on top of the anvil.

Writing the Anvil Recipe JSON

Place the file under data/<namespace>/recipes/ in your datapack. Set the recipe type to Lychee's anvil interaction type. You then define the left input (the item placed on the anvil), the right input (the item used on it, if any), and the output. Lychee also lets you attach a level cost or XP cost so the anvil consumes experience when the recipe fires. Keep the input and output item IDs exactly as they appear in the registry.

Applying and Verifying

Run /reload and test by placing the left input on the anvil and using the right input on it. If the anvil refuses the combination, confirm the recipe type string matches Lychee's registered identifier and that both inputs are present. Check the log for parse errors — a single typo in an item ID will silently disable the recipe.