Skip to content

Instantly share code, notes, and snippets.

@lionel5116
Created February 29, 2016 13:47
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 lionel5116/e0461afeb4fcd0c59f03 to your computer and use it in GitHub Desktop.
Save lionel5116/e0461afeb4fcd0c59f03 to your computer and use it in GitHub Desktop.
LjonesModdingProject
package com.lionel.ljonesmodding;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemPickaxe;
public class itemModPickaxe extends ItemPickaxe{
public itemModPickaxe(ToolMaterial material, String itemName){
super(material);
this.setUnlocalizedName(itemName);
this.setCreativeTab(CreativeTabs.tabMaterials);
}
}
package com.lionel.ljonesmodding;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
public final class ModItems {
public static Item berry;
public static Item ljonesbadasspickaxe;
public static Item ljonesmastersword;
//First Param:name of material, "Unique Name"- not that important what you name it
//Second Param:Harvest Level - decides what kinds of blocks you can mine 3 = very high, you can mine diamonds
//Third Param: Amount ot times the tool can be used
//Forth Param:Tool Speed
//Fifth Param: Enchantability
static ToolMaterial samium = EnumHelper.addToolMaterial("samium", 3, 1000, 9.5F, 3.5F, 10);
//***IMPORTANT, FOR PICKAXE'S JSON, YOU WILL NOTICE THE thirdperson's parameters are different for this item item type ***
public static void createItems(){
//below would be to register a basic item instead
//GameRegistry.registerItem(berry = new BasicItem("berry"), "berry");
//let's change this to register a food item instead
GameRegistry.registerItem(berry = new ItemModFood("berry",3,0.3F,true),"berry");
GameRegistry.registerItem(ljonesbadasspickaxe = new itemModPickaxe(samium,"ljonesbadasspickaxe"),"ljonesbadasspickaxe");
GameRegistry.registerItem(ljonesmastersword = new itemModSword(samium,"ljonesmastersword"),"ljonesmastersword");
}
}
package com.lionel.ljonesmodding;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModRecipes {
public static void addRecipes(){
//recipes
//Create an apple with the 2x2 grid for 4 apples using cobblestone
GameRegistry.addRecipe(new ItemStack(Items.apple, 4), new Object[]{
"AA",
"AA",
'A', Blocks.cobblestone
});
//the custom berry was created without a crash, but I lost the item.name abd textures
GameRegistry.addRecipe(new ItemStack(ModItems.berry, 4), new Object[]{
"A",
"A",
"A",
'A', Items.apple
});
//let's make a recipe for my bad ass sword
GameRegistry.addRecipe(new ItemStack(ModItems.ljonesmastersword), new Object[]{
"SS",
"SS",
"SS",
'S', Blocks.cobblestone
});
//let's make a recipe for my bad ass pickaxe - investigate why this works with 3 cobblestones vertically without the second row having "2"
GameRegistry.addRecipe(new ItemStack(ModItems.ljonesbadasspickaxe), new Object[]{
"R",
"R",
'R', Blocks.cobblestone
});
//blocks - let's make some OBSIDIAN BLOCKS
GameRegistry.addRecipe(new ItemStack(Blocks.obsidian), new Object[]{
"AAA",
"AAA",
"AAA",
'A', Blocks.cobblestone
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment