2

Creating stuff with ModLoader||Items

2 diamonds

  • 120
    Views, 4 today
  • 1
    Comments
  • 0
    Favorites
  • Flag / Report

Get Embed Code

Forum:
HTML:
Link:
avatar GoldButterKnife
Level 27 : Expert Modder
Posted 07/09/12 6:27:49 pm
07/09/12
Start off with a new class called mod_nuggetIron. As that's what I'll be teaching you how to make. In another tutorial I will show how to use these to make an iron block.
Here's the Code that I will be explaining:

mod_nuggetIron.java
package net.minecraft.src;

public class mod_nuggetIron extends BaseMod
{

public static final Item ni = new Item(222).setItemName("ni");

public void load()
{
ni.iconIndex = ModLoader.addOverride("/gui/items.png","/ni.png");
ModLoader.addName(ni,"Iron Nuggets");
ModLoader.addShapelessRecipe(new ItemStack(ni, 9), new Object [] {
"$", Character.valueOf('$'), (Item.ingotIron)});
}
public String getVersion()
{
return "1.2.5";
}
}
- public class mod_nuggetIron extends BaseMod
This is telling that it's using ModLoader, and declaring the class name.

- public static final Item ni = new Item(222).setItemName("ni");
"public static final Item ni = new Item(222)" This is letting Java know that the Item "ni" will be using the Item ID, 222.

".setItemName("ni")" Delaring the variable to be used for the item.

- ni.iconIndex = ModLoader.addOverride("/gui/items.png","/ni.png");
"ModLoader.addOverride" Letting ModLoader know that this will be adding an override for the items.png file.

"("/gui/items.png","/ni.png")" "/ni.png" means it will be using the texture called ni located inside the minecraft.jar, you will have to create the texture.


- ModLoader.addName(ni,"Iron Nuggets");
This is giving the Item a name to be displayed ingame. 
(variable,"INGAMENAME");

- ModLoader.addShapelessRecipe(new ItemStack(ni, 9), new Object [] { "$", Character.valueOf('$'), (Item.ingotIron)});
addShapelessRecipe means you will be creating a recipe which has no set shape. Just like making a gold ingot into gold nuggets.

- public String getVersion() { return "1.2.5"; }
This lets Minecraft know what version the mod is made for so it knows if it is capable of running the mod.

Well that's my first tutorial ever... Let me know if I should do one for blocks and food! Feel free to take the code that I used for this. I honestly don't care. But have fun making the texture for it :)

Additional Details

Tags:ModLoader, Tutorials, Trololol, Items, Nuggets, Iron Nuggets, ModLoader Tutorial, MatthewH1998, GBK, GoldButterKnife, Tutorial

More Blogs by GoldButterKnifeView All

Update #1 : 07/09/2012 8:33:13 pm7/09/12

Made minor tweaks.

Join us to post comments.

Comments : 1

1 - 1 of 1

Larvitarian
Level 27
Expert Pixel Painter
July 9, 2012, 3:15 pm

:D i want a tutorial on how to make blocks; and maybe a mob tutorial if you can, so i can make the add on for Mo' Noms

1 - 1 of 1