Adding Shapeless Crafting Recipes

If you haven’t already, check out the shaped crafting recipe tutorial. That’s needed before you can follow this tutorial.

Go to your ModRecipes class. If you don’t know what it is, you might want to read the shaped crafting tutorial I made.

I am going to add a recipe to craft the red diamond block back into nine red diamonds. So here’s the code you need to add:

GameRegistry.addShapelessRecipe(new ItemStack(ModItems.red_diamond, 9), ModBlocks.red_diamond_block);

The first parameter is the output, as an ItemStack. The second and forth parameters are what’s needed to make the item. For example, flint and steel is as follows:

GameRegistry.addShapelessRecipe(new ItemStack(Items.flint_and_steel), Items.iron_ingot, Items.flint);

If you want two of the same items, you can specify it twice, or use ItemStacks.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s