Hey guys!
I tried to code a little mod generating additional ores (Vanilla + IC2 + Appeng).
After reading me into the api stuff again, I fetched the Itemstack of the ore with
Next I used the way described in the api to create a Block from an ItemStack
eclipse and mcp don't give me any errors, I can recompile and reobfuscate.
But when I start up my mc, It crashes, giving me an error in this line:
Code
Block c_Ore = Block.blocksList[copperstack.itemID]
//(here I also tried other names instead of c_Ore like copperore and copperoreblock)
The error is:
Code
java.lang.NullPointerException
at addore.moreore.IC2Ore.<init>(IC2Ore.java:21) //given line from above
at addore.moreore.AdditionalOres.<init>(AdditionalOres.java:41) //main mod file, calling the generator with line above here
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:168)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:466)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)
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.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:103)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:504)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:163)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:411)
at net.minecraft.client.MinecraftAppletImpl.func_71384_a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:733)
at java.lang.Thread.run(Unknown Source)
Display More
can anyone tell me what I'm doing wrong?
It is sufficient to only have the Id in my code, so I also tried
which gives me the samme error on game startup.
Thanks for helping me, If you need more of my code, tell me.
- Shad0w