Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

It should be

ModLoader.addRecipe(new ItemStack(_Mod_Yamiko.swordLapis, 1), new Object[]{
            " X ", " X ", " Y ",
            Character.valueOf("X"), Block.dirt, 
            Character.valueOf("Y"), Item.stick 
        });

when referencing the characters

share|improve this answer
    
You mean Character.valueOf('X') with single quotes, right? Although I'm a bit surprised (having not worked with Java much lately) that just using a primitive char literal in an Object array doesn't simply autobox it. –  Ilmari Karonen Nov 3 '12 at 12:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.