Skip to content

Instantly share code, notes, and snippets.

Created July 29, 2015 11:58
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/aece7960622d4d8ee76c to your computer and use it in GitHub Desktop.
Save anonymous/aece7960622d4d8ee76c to your computer and use it in GitHub Desktop.
package com.drunksmanknife.harshnature.init;
import com.drunksmanknife.harshnature.Reference;
import com.drunksmanknife.harshnature.init.tools.ModAxe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.client.EnumHelperClient;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class HarshNatureItems
{
public static Item Small_Flint;// yes
public static Item Twigs;// Um....guess
public static Item Axehead;// - Flint axehead
public static Item Tied_Axehead;// - Tied Axehead with grass rope
public static Item Grassmade; // - Grass Rope
public static Item Grassstem;
public static Item Flintaxe;
public static Item Berries;
public static ToolMaterial material;
public static void init() // Initilizing the item and its name
{
Small_Flint = new Item().setUnlocalizedName("Small_Flint");
Twigs = new Item().setUnlocalizedName("Twigs");
Axehead = new Item().setUnlocalizedName("Axehead");
Tied_Axehead = new Item().setUnlocalizedName("Tied_Axehead");
Grassmade = new Item().setUnlocalizedName("Grassmade");
Grassstem = new Item().setUnlocalizedName("Grassstem");
material = EnumHelperClient.addToolMaterial("Flintaxe", 1, 250, 4.2F, 3.0F, 5); Flintaxe = new ModAxe(material);
}
public static void register() // registering the item
{
GameRegistry.registerItem(Small_Flint, Small_Flint.getUnlocalizedName().substring(5));
GameRegistry.registerItem(Twigs, Twigs.getUnlocalizedName().substring(5));
GameRegistry.registerItem(Axehead, Axehead.getUnlocalizedName().substring(5));
GameRegistry.registerItem(Tied_Axehead, Tied_Axehead.getUnlocalizedName().substring(5));
GameRegistry.registerItem(Grassmade, Grassmade.getUnlocalizedName().substring(5));
GameRegistry.registerItem(Grassstem, Grassstem.getUnlocalizedName().substring(5));
GameRegistry.registerItem(Flintaxe, Flintaxe.getUnlocalizedName().substring(5));
GameRegistry.registerItem(Berries, Berries.getUnlocalizedName().substring(5));
}
public static void registerRenders() //render it into a pattern
{
registerRender(Small_Flint);
registerRender(Twigs);
registerRender(Axehead);
registerRender(Tied_Axehead);
registerRender(Grassmade);
registerRender(Grassstem);
registerRender(Flintaxe);
registerRender(Berries);
}
public static void registerRender(Item item) // the pattern
{
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment