Minecraft Blogs / Tutorial

How to make a Minecraft Mod for 1.7.10 - Blog 4 - Adding Items!

  • 547 views, 1 today
  • 1
  • 0
Planetjoshua's Avatar Planetjoshua
Level 24 : Expert Architect
10
Welcome to minecraft MODDING! Today we will add
A
ITEM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
So 1st hit your main package i acsudly renamed it to com.joshua.lib and for Main so make a new one delecate it to items for your mod or like com.yourname.items or item

New class in there name it: MItems this class will have all your Items in it. Blog 5 Will show you how to make Multiple Items in a Smart way in the class type this:

public static void mainRegistry() {

}

public static void initalizeItem() {

}

public static void registerItem() {




}

now in your MainRegistry class PreLoad voix type in there: MItems.mainRegistry();




Now when it reads the void then it needs to load it so in the mainRegistry void in MItems type:

initializeItem();
registerItem();


You can do this dot but it can not be used in a static content

so under that type:

public static Item lStick; as Lava Stick NOTE: DO NOT COPY A MOD.

Import Item to net.minecraft.item

Now in your initializeItem method:


lStick = new Item().setUnlocalizedName("lStick").setCreativeTab(must do if going to have it in a tab)(CreativeTabs.tabMaterials(Soon we will have our own just type CreativeTabs.a Creative Tab.))(optional).setMaxStackSize(64).setTextureName(RefStrings.MODID +
":lStick");

Import CreativeTabs to net.minecraft.creativetab.CreativeTabs
Import RefStrings to com.yourname.lib or whatever it is

Now in your registerItem method:

GameRegistry.registerItem(lStick, lStick.getUnlocalizedName());

Now in your main mod folder go in Src main java make a new folder name it assets
then yourmodid and in the folder lang

Make a new text document save it as en_US.lang and as a Lang file.

In eclipse with it type item.lStick.name=Lava Stick

Now run there's your item.

Thanks for reading this tutorial!
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome