Home > Articles > Home & Office Computing > Entertainment/Gaming/Gadgets

  • Print
  • + Share This
This chapter is from the book

Creating a Shapeless Recipe

Shapeless recipes work similar to standard recipes. They are also set in GameRegistry and take the same parameters. The following code is the dye recipe redone in a shapeless recipe.

GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 2, 1),
       Items.redstone, new ItemStack(Items.dye, 1, 1)
);

In a shapeless recipe there is no need for letters or a crafting grid. You place up to nine Item, Block, or ItemStack objects in the Object array separated by commas, and the recipe will work. Except for that, it works exactly the same.

In game, this recipe can be crafted in the Player’s inventory and looks like Figure 3.3.

FIGURE 3.3

FIGURE 3.3 A shapeless recipe.

  • + Share This
  • 🔖 Save To Your Account