Jump to content

Oredictionary recipes


Dwargkiller

Recommended Posts

Hello!

 

I understand it may be frustrating when someone doesn't know what the hell they are doing, but I'm at my wits end. I'm getting an exception when I launch the game with my mod after trying to add oredictionary to my recipe.

 

Below is my code that is causing the crash.

 GameRegistry.addRecipe(new ItemStack(Block.wood,3),"x ","xx", 'x', "logWood");

 

Below is working code (that doesn't do what I'm trying to accomplish)

 GameRegistry.addRecipe(new ItemStack(Block.wood,3),"x ","xx", 'x', Block.wood);

 

The error is below.

 

 

2013-11-28 17:24:21 [sEVERE] [ForgeModLoader] Caught exception from UniversalWood

java.lang.NullPointerException

at net.minecraft.item.crafting.CraftingManager.func_92103_a(CraftingManager.java:213)

at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:244)

at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:239)

at universalwood.UniversalWood.load(UniversalWood.java:54)

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:494)

at sun.reflect.GeneratedMethodAccessor3.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.initializeMods(Loader.java:691)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:213)

at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:448)

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)

 

 

Thank you for any help you can give me. Sometimes I make myself tired..

 

EDIT: Here's what I was supposed to do:

GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Block.wood,3), true, new Object[]{"x ","xx", 'x', "logWood"}));

Link to comment
Share on other sites

As far as i know, this "x ","xx", 'x', Block.wood works because it requires an item or a block.

This "x ","xx", 'x', "logWood" is using a string which the new recipe method wont accept.

If you want to use a custom item, instead of "logwood" follow the pattern of "Block.wood"

For example if your Block class is called MyBlocks, you would use: MyBlocks.logwood

It will prompt to import that class and it should work.

Hope this helps!

Link to comment
Share on other sites

Much progress! It is working! I implemented it wrong. My code declared that there was a new recipe, but didn't actually register it. For others with similar problem, here's what I did:

 

GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Block.wood,3), true, new Object[]{"x ","xx", 'x', "logWood"}));

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.