Recipe Viewer

As someone who often plays Minecraft with mods like NEI, I figured a recipe plugin would be useful.
The interface is entirely chat based and very rough around the edges, but it works for most crafting recipes.

To use, simply use /recipes, /recipesfor, or /howdoimake with the id of the item you wish to craft. In addition, you can click the item names in the output to get their recipes without typing.


The lack of an implementation for the Recipe API means that I had to use hacky reflection to access the vanilla classes, but it should use the official recipe API as soon as it’s implemented.

I plan on improving the user interface in the future as well as add support for smelting, potions, etc. recipes as well. Let me know what you think and if I should continue working on this. Thank you.


This looks really useful! I like it!

Thank you for your kind words.

It looks great, but could you perhaps shorten the “=========” down a bit? It takes up an awful big part of the screen. Or perhaps make that configurable in some way?

That’s default behaviour for the pagination service, looking at the current API, all that be changed is the character used without getting rid of pagination entirely. Granted it’s not working the way I wanted with 1 recipe per page so I might do just that anyway.

You should use MCP directly for accessing internal Minecraft classes, using reflection will not make you proof against updates nor really provide any other benefit except code that is extremely hard to maintain, read, and update. For example using MCP directly would do all the obfuscation work for you that you do manually currently.

I was having trouble linking with MCP. If you can point to some way to link with both Sponge and MCP at the same time, that would be nice. The reflection is just a fallback that will likely be removed when Sponge implements the recipe api.

This may help you if you’re using Gradle:

Thank you, that’s exactly what I needed. Now to find a way to cast net.minecraft.item.ItemStack to org.spongepowered.api.item.inventory.ItemStack.

Have you tried just casting them?

(org.spongepowered.api.item.inventory.ItemStack) mcpStack

/home/[REDACTED]/IdeaProjects/MiscSponge/RecipeView/build/sources/main/java/boomshroom/recipeview/fallback/ error: incompatible types: net.minecraft.item.ItemStack cannot be converted to org.spongepowered.api.item.inventory.ItemStack ItemStack itemStack = (org.spongepowered.api.item.inventory.ItemStack) wrapped.getRecipeOutput();

In addition, the necessary fields for accessing the data in the recipes is still private.

Try casting to Object first, e.g. (org.spongepowered.api.item.inventory.ItemStack) (Object) mcpStack

That works and is a hack, though it’s less of a hack than ItemStack.class.cast(mcpStack)

You need (and should) use an access transformer for accessing private fields. If you can join #spongedev on our IRC for a moment I can help you to set them up.

Shortly said:

Does this work with modded items? such as pixelmon?

It currently only supports crafting table recipes, but it should work with modded items, though I have not tested it.