Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

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!

  • Author

Thanks

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

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.