Posted August 10, 201411 yr I've tried numerous times to register my items / blocks into the Ore Dictionary with no success. My game just crashes when I run it. Just to get this cleared up right away, isn't this the code you use to add an ore to the dictionary? OreDictionary.registerOre("oreCopper", oreCopper); Crash Report: ---- Minecraft Crash Report ---- // But it works on my machine. Time: 8/9/14 9:49 PM Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:267) at net.minecraftforge.oredict.OreDictionary.registerOreImpl(OreDictionary.java:454) at net.minecraftforge.oredict.OreDictionary.registerOre(OreDictionary.java:432) at net.minecraftforge.oredict.OreDictionary.registerOre(OreDictionary.java:431) at net.raccoon.stuffplus.core.Stuff.add(Stuff.java:101) at net.raccoon.stuffplus.core.Main.preInit(Main.java:13) 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:532) at net.minecraft.client.Minecraft.run(Minecraft.java:941) 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:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) 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 GradleStart.bounce(GradleStart.java:108) at GradleStart.startClient(GradleStart.java:101) at GradleStart.main(GradleStart.java:56) Errors I've noticed: at net.raccoon.stuffplus.core.Stuff.add(Stuff.java:101) OreDictionary.registerOre("oreCopper", oreCopper); at net.raccoon.stuffplus.core.Main.preInit(Main.java:13) Stuff.add(); <-- Under FMLPreInitialization
August 10, 201411 yr Post your Stuff and your Main classes. BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
August 10, 201411 yr Author My Main mod class: http://pastebin.com/KkGtV8ae My Stuff.class: http://pastebin.com/MtmWSKVQ ^ Ore Dictionary is at the bottom
August 10, 201411 yr That's very weird. Have you tried registering it as a new ItemStack? That shouldn't make a difference, but it doesn't hurt to try. BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
August 10, 201411 yr Author I've tried it as itemstack just now OreDictionary.registerOre("oreCopper", new ItemStack(oreCopper, 1, 0)); Still crashed for some reason.. Not sure what's going on. Here's the new crash report if you want it: http://pastebin.com/ZsrZpmzw EDIT: To make things even weirder I've run one of my older 1.6.4 mods with oredictionary and it works just fine. OreDictionary.registerOre("nuggetIron", new ItemStack(ironNugget));
August 10, 201411 yr Item.getItemFromBlock seems to be returning null. Try registering to the OreDictionary in the init method (the one with the FMLInitializationEvent, rather than the FMLPreInitializationEvent). BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
August 10, 201411 yr Author Wow, you are a life saver. I knew it was probably something stupid like that, turns out if you move it to Init it does work. Thanks!
August 10, 201411 yr You're welcome C: BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
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.