First Minecraft mod not working: make a new sword

Posted by yamikoWebs on Game Development See other posts from Game Development or by yamikoWebs
Published on 2012-08-13T07:45:07Z Indexed on 2012/10/03 21:56 UTC
Read the original article Hit count: 305

Filed under:
|
|

I am making my first mod and cannot see what is wrong with it. I am using MCP and Modloader. For my first mod I was going to make swords.

I started with making a new EnumToolMaterials

WOOD(0, 59, 2.0F, 0, 15),
STONE(1, 131, 4.0F, 1, 5),
IRON(2, 250, 6.0F, 2, 14),
LAPIS(3, 750, 7.0F, 2, 14),
OBSIDIAN(3, 1000, 7.5F, 3, 12),
EMERALD(3, 1561, 8.0F, 3, 10),//diamond
GREEN(3, 2000, 9.0F, 4, 10),//emerald
GOLD(0, 200, 12.0F, 0, 22);

then here is the mod class

public class _Mod_Yamiko extends BaseMod{

    /* mod itemts */
    public static final Item swordLapis = (new ItemSword(600, EnumToolMaterial.LAPIS)).setItemName("swordLapis");
    public static final Item swordObsidian = (new ItemSword(601, EnumToolMaterial.OBSIDIAN)).setItemName("swordObsidian");
    public static final Item swordGreen = (new ItemSword(602, EnumToolMaterial.GREEN)).setItemName("swordGreen");

    public void load(){
        //set images
        swordLapis.iconIndex = ModLoader.addOverride("/gui/items.png","/gui/swordLapis.png");

        ModLoader.addName(swordLapis, "Lapis Sword");
        //craft
        ModLoader.addRecipe(new ItemStack(_Mod_Yamiko.swordLapis, 1), new Object[]{
            " X ", " X ", " Y ",
            'X', Block.dirt, 
            'Y', Item.stick 
        });
    }

    public String getVersion(){
        return "0.1";
    }
}

Then I made a 16×16 .png image. I am not sure where to save it so I recompiled and reobfuscated, took the mod files and put it in my local Minecraft install, added the image where it be should be. No problems when playing but I cannot make the new sword.

© Game Development or respective owner

Related posts about java

Related posts about minecraft