Jump to content

Recommended Posts

Posted

Getting NullPointException on launch with this line of code (almost 90% sure it's something to do with my sword declarations). Am not sure what to change to fix it.

 

 

@EventHandler
public void preinit(FMLPreInitializationEvent event)
{
zeldaItem = new ZeldaItem();
GameRegistry.registerItem(zeldaItem, "zeldaItem");
GameRegistry.addSmelting(new ItemStack(zeldaOre, 1, 1), new ItemStack(zeldaItem, 1, 11), 0.1F);

fighterSword = new ZeldaSwordL1(null, null);
GameRegistry.registerItem(fighterSword = new ZeldaSwordL1("fighterSword", fighterMaterial), "fighterSword");

fighterShield = new ZeldaShieldL1();
GameRegistry.registerItem(fighterShield, "fighterShield");

masterSword = new ZeldaSwordL2(null, null);
GameRegistry.registerItem(masterSword = new ZeldaSwordL2("masterSword", masterMaterial), "masterSword");

temperedSword = new ZeldaSwordL3(null, null);
GameRegistry.registerItem(temperedSword = new ZeldaSwordL3("temperedSword", temperedMaterial), "temperedSword");

goldenSword = new ZeldaSwordL4(null, null);
GameRegistry.registerItem(goldenSword = new ZeldaSwordL4("goldenSword", goldenMaterial), "goldenSword");

redShield = new ZeldaShieldL2();
GameRegistry.registerItem(redShield, "redShield");

mirrorShield = new ZeldaShieldL3();
GameRegistry.registerItem(mirrorShield, "mirrorShield");

masterOre = new ZeldaBlocky();
GameRegistry.registerBlock(masterOre, "masterOre");

zeldaOre = new ZeldaBlock();
GameRegistry.registerBlock(zeldaOre, "zeldaOre");
GameRegistry.addRecipe(new ItemStack(temperedSword), new Object[]{
"XXX",
"AYA",
"XXX",
'A', masterOre, 'Y', fighterSword
});

 

 

The (null, null) comes from where I have additional arguments in my sword classes, I am sure that is where the exception is coming from, but I do not know how to fix it.

 

 

public class ZeldaSwordL1 extends ItemSword{

public ZeldaSwordL1(String unlocalizedName, ToolMaterial material) {
        super(material);
        this.setUnlocalizedName(unlocalizedName);
        this.setTextureName(ZeldaMod.MODID + ":" + unlocalizedName);

 

 

If someone could help me out on what I am supposed to use to replace (null, null) I would be most grateful.

There's 10 types of people in this world; Those that understand binary and those that don't.

Posted

Replace it with an unlocalized name and a tool material. those are the args. look at vanilla code and other mods.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.