Jump to content

HELP!!!!! Error when launching mod


hawkwing7am

Recommended Posts

When i load my custom mod, it crashes and says something, please tell me what wrong and how to fix it.

-Hawk

 

 

 

[17:50:34] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----

// Uh... Did I do that?

 

Time: 2/11/15 5:50 PM

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

at com.James.item.MItems.registerItem(MItems.java:45)

at com.James.item.MItems.mainRegistry(MItems.java:16)

at com.James.Main.MainRegistry.Preload(MainRegistry.java:24)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)

at net.minecraft.client.Minecraft.run(Minecraft.java:931)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)

at GradleStart.main(GradleStart.java:45)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at com.James.item.MItems.registerItem(MItems.java:45)

at com.James.item.MItems.mainRegistry(MItems.java:16)

at com.James.Main.MainRegistry.Preload(MainRegistry.java:24)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:931)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)

at GradleStart.main(GradleStart.java:45)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.8.0_31, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 869288440 bytes (829 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized

FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized

Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized

trembleempiresmod{0.1} [Tremble Empires Mod] (bin) Unloaded->Constructed->Errored

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: GeForce 310M/PCI/SSE2 GL version 3.1 NVIDIA 187.83, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

[17:50:34] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\James Li\Desktop\TE Mod\eclipse\.\crash-reports\crash-2015-02-11_17.50.34-client.txt

Java HotSpot 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

Link to comment
Share on other sites

Hi

 

Almost certainly you are registering an item that you haven't instantiated yet (i.e. using new() ).

at com.James.item.MItems.registerItem(MItems.java:45)

 

These links will help you understand how to troubleshoot this type of error yourself.  It will save you an awful of time and frustration...

http://www.terryanderson.ca/debugging/run.html

http://www.vogella.com/tutorials/EclipseDebugging/article.html

 

-TGG

Link to comment
Share on other sites

I need the see your src, specifically MyItems src.

Also put the crash report in code tags, it makes it easier to read.

 

I removes some of the codes that i dont need. So here it is.

 

 

package com.James.item;

 

import com.James.blocks.MBlocks;

import com.James.creativetabs.MCreativeTabs;

import com.James.lib.RefStrings;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.Item.ToolMaterial;

import net.minecraftforge.common.util.EnumHelper;

 

public class MItems {

public static void mainRegistry(){

initializeItem();

registerItem();

}

 

public static ToolMaterial persitetool = EnumHelper.addToolMaterial("Persite Tool", 3, 2000, 16.5f, 4.5f, 10);

 

public static Item persitepick;

public static Item persiteaxe;

public static Item persitesword;

public static Item persitespade;

public static Item persitehoe;

 

public static void initializeItem(){

persitepick = new persitepick(persitetool).setUnlocalizedName("persitepick").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitepick");

persiteaxe = new persiteaxe(persitetool).setUnlocalizedName("persiteaxe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persiteaxe");

persitesword = new persitesword(persitetool).setUnlocalizedName("persitesword").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitesword");

persitespade = new persitespade(persitetool).setUnlocalizedName("persitespade").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitespade");

persitehoe = new persitehoe(persitetool).setUnlocalizedName("persitehoe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitehoe");

}

 

public static void  registerItem(){

GameRegistry.registerItem(persitepick, persitepick.getUnlocalizedName());

GameRegistry.registerItem(persiteaxe, persiteaxe.getUnlocalizedName());

GameRegistry.registerItem(persitesword, persitesword.getUnlocalizedName());

GameRegistry.registerItem(persitespade, persitespade.getUnlocalizedName());

GameRegistry.registerItem(persitehoe, persitehoe.getUnlocalizedName());

}

}

Link to comment
Share on other sites

I need your updated crash report as well. And put it in a code block otherwise it just fills up the entire page.

 

The reg crash IS the updated crash.

 

package com.James.item;

import com.James.blocks.MBlocks;
import com.James.creativetabs.MCreativeTabs;
import com.James.lib.RefStrings;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper;

public class MItems {
   public static void mainRegistry(){
       initializeItem();
       registerItem();
   }
   
   public static ToolMaterial persitetool = EnumHelper.addToolMaterial("Persite Tool", 3, 2000, 16.5f, 4.5f, 10);

   public static Item persitepick;
   public static Item persiteaxe;
   public static Item persitesword;
   public static Item persitespade;
   public static Item persitehoe;
   
   public static void initializeItem(){
      persitepick = new persitepick(persitetool).setUnlocalizedName("persitepick").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitepick");
      persiteaxe = new persiteaxe(persitetool).setUnlocalizedName("persiteaxe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persiteaxe");
      persitesword = new persitesword(persitetool).setUnlocalizedName("persitesword").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitesword");
      persitespade = new persitespade(persitetool).setUnlocalizedName("persitespade").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitespade");
      persitehoe = new persitehoe(persitetool).setUnlocalizedName("persitehoe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitehoe");
   }
   
   public static void  registerItem(){
      GameRegistry.registerItem(persitepick, persitepick.getUnlocalizedName());
      GameRegistry.registerItem(persiteaxe, persiteaxe.getUnlocalizedName());
      GameRegistry.registerItem(persitesword, persitesword.getUnlocalizedName());
      GameRegistry.registerItem(persitespade, persitespade.getUnlocalizedName());
      GameRegistry.registerItem(persitehoe, persitehoe.getUnlocalizedName());
   }
}

Link to comment
Share on other sites

I need your updated crash report as well. And put it in a code block otherwise it just fills up the entire page.

 

The reg crash IS the updated crash.

 

That is impossible. Either you didn't send the entire src file or you sent an outdated version That crash report specifically states that the issue is in line 45 but your code only goes to line 42. Please re-run it and re-submit your crash report.

Link to comment
Share on other sites

I need your updated crash report as well. And put it in a code block otherwise it just fills up the entire page.

 

The reg crash IS the updated crash.

 

That is impossible. Either you didn't send the entire src file or you sent an outdated version That crash report specifically states that the issue is in line 45 but your code only goes to line 42. Please re-run it and re-submit your crash report.

 

package com.James.item;

import com.James.blocks.MBlocks;
import com.James.creativetabs.MCreativeTabs;
import com.James.lib.RefStrings;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper;

public class MItems {
public static void mainRegistry(){
	 initializeItem();
	 registerItem();
}

public static ToolMaterial persitetool = EnumHelper.addToolMaterial("Persite Tool", 3, 2000, 16.5f, 5.5f, 10);

public static Item persitegem;
public static Item electricshard;
public static Item mineralstick;
public static Item meltedmineral;
public static Item persitepick;
public static Item persiteaxe;
public static Item persitesword;
public static Item persitespade;
public static Item persitehoe;

public static void initializeItem(){
	persitegem = new Item ().setUnlocalizedName("persitegem").setCreativeTab(MCreativeTabs.tabItems).setTextureName(RefStrings.MODID + ":persite");
	electricshard = new Item ().setUnlocalizedName("electricshard").setCreativeTab(MCreativeTabs.tabItems).setTextureName(RefStrings.MODID + ":electricshard").getItemFromBlock(MBlocks.electrico);
	mineralstick = new Item ().setUnlocalizedName("mineralstick").setCreativeTab(MCreativeTabs.tabItems).setTextureName(RefStrings.MODID + ":mineralstick");
	meltedmineral = new Item ().setUnlocalizedName("meltedmineral").setCreativeTab(MCreativeTabs.tabItems).setTextureName(RefStrings.MODID + ":meltedmineral");
	persitepick = new persitepick(persitetool).setUnlocalizedName("persitepick").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitepick");
	persiteaxe = new persiteaxe(persitetool).setUnlocalizedName("persiteaxe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persiteaxe");
	persitesword = new persitesword(persitetool).setUnlocalizedName("persitesword").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitesword");
	persitespade = new persitespade(persitetool).setUnlocalizedName("persitespade").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitespade");
	persitehoe = new persitehoe(persitetool).setUnlocalizedName("persitehoe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":persitehoe");
}

public static void  registerItem(){
	GameRegistry.registerItem(persitegem, persitegem.getUnlocalizedName());
	GameRegistry.registerItem(electricshard, electricshard.getUnlocalizedName());
	GameRegistry.registerItem(mineralstick, mineralstick.getUnlocalizedName());
	GameRegistry.registerItem(meltedmineral, meltedmineral.getUnlocalizedName());
	GameRegistry.registerItem(persitepick, persitepick.getUnlocalizedName());
	GameRegistry.registerItem(persiteaxe, persiteaxe.getUnlocalizedName());
	GameRegistry.registerItem(persitesword, persitesword.getUnlocalizedName());
	GameRegistry.registerItem(persitespade, persitespade.getUnlocalizedName());
	GameRegistry.registerItem(persitehoe, persitehoe.getUnlocalizedName());
}
}

Link to comment
Share on other sites

I need your updated crash report as well. And put it in a code block otherwise it just fills up the entire page.

 

The reg crash IS the updated crash.

 

That is impossible. Either you didn't send the entire src file or you sent an outdated version That crash report specifically states that the issue is in line 45 but your code only goes to line 42. Please re-run it and re-submit your crash report.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Hi.

 

I guess you didn't try what I suggested?

 

The crash is on your line 45:

GameRegistry.registerItem(electricshard, electricshard.getUnlocalizedName());

 

A null pointer exception here means electricshard is null.  If you're not keen to learn about the debugger, you can also check this using this command:

 

System.out.println("electricshard:" + String.valueOf(electricshard));

GameRegistry.registerItem(electricshard, electricshard.getUnlocalizedName());

 

 

electricshard is set here

33:

electricshard = new Item ().setUnlocalizedName("electricshard").setCreativeTab(MCreativeTabs.tabItems).setTextureName(RefStrings.MODID + ":electricshard").getItemFromBlock(MBlocks.electrico);

 

Something in this line must be setting electricshard to null.

Hint - I think you have misunderstood how to use this method correctly.  When you register a block, it automatically registers an ItemBlock (extends Item) for you as well.  You can use this method to retrieve it, but you don't need all the new Item() since it is a static method, i.e. you can write Item.getItemFromBlock.  The block must have been instantiated and registered already.

    public static Item getItemFromBlock(Block p_150898_0_)
    {
        return getItemById(Block.getIdFromBlock(p_150898_0_));
    }

 

-TGG

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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