Skip to content

Instantly share code, notes, and snippets.

Created July 29, 2016 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/536e6a8546873f95f7f4b75a4857ab53 to your computer and use it in GitHub Desktop.
Save anonymous/536e6a8546873f95f7f4b75a4857ab53 to your computer and use it in GitHub Desktop.
package com.bigsis.spookjams.init; //My comments in this class are present in light-colored lines like this one that follow two forward-slashes ("//"). To remove these, go to "Edit > Find/Replace...", add "//.*" to the Find field, and press "Replace All".
import net.minecraft.init.Blocks; //Imported to recognize Minecraft Block objects.
import net.minecraft.init.Items; //Imported to recognize Minecraft Item objects.
import net.minecraft.item.ItemStack; //Imported to recognize the ItemStack object.
import net.minecraftforge.fml.common.registry.GameRegistry; //Imported to recognize the GameRegistry object.
public class ModCrafting {
public static void register()
{
GameRegistry.addShapedRecipe //This creates a shaped recipe, which is the type of recipe that requires specific placement on the crafting grid.
(
new ItemStack(ModItems.cheese, 4), //This recipe is to make cheese, specifically 4 wedges of it.
"BMB", //This recipe specifically calls for a horizontal row of a milk bucket in the center, flanked by two brown mushrooms; note that since we only specify one row on the grid, you can craft these items on any row.
'B', Blocks.BROWN_MUSHROOM, //This specifies that "B" stands for the Brown Mushroom "bush", not the block from a giant brown mushroom. Note that the use of the single quote it intentional... it MUST BE IN SINGLE QUOTES!
'M', new ItemStack(Items.MILK_BUCKET.setContainerItem(Items.BUCKET)) //This specifies that "M" stands for a milk-filled bucket; to avoid using up a whole metal bucket just to make cheese, we also indicate that an empty bucket be returned after this crafting recipe is processed. Note that the use of the single quote it intentional... it MUST BE IN SINGLE QUOTES!
);
GameRegistry.addShapedRecipe
(
new ItemStack(ModItems.gf_bread, 3), //This recipe is to make gluten-free bread, specifically 3 loaves of it (because the ingredients are more nutrient-dense).
"PPP", //This recipe specifically calls for a horizontal row of potatoes; note that since we only specify one row on the grid, you can craft these items on any row.
'P', Items.POTATO //This specifies that "P" stands for "potato". Note that the use of the single quote it intentional... it MUST BE IN SINGLE QUOTES!
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment