Jump to content

Recommended Posts

Posted (edited)

My ShapedOreRecipe isn't working properly. I registered it with several other recipes. the only one that doesnt work is this one: 

new ShapedOreRecipe(new ItemStack(ModBlocks.PACKER), "I I", "WSW", "WCW", 'I', "ingotIron", 'S', new ItemStack(ModItems.SCHOKO_INGOT, 1, 0), 'C', Blocks.CAULDRON, 'W', "plankWood")

to debug, I printed the recipes contents:

ShapedOreRecipe sor = new ShapedOreRecipe(new ItemStack(ModBlocks.PACKER), "I I", "WSW", "WCW", 'I', "ingotIron", 'S', new ItemStack(ModItems.SCHOKO_INGOT, 1, 0), 'C', Blocks.CAULDRON, 'W', "plankWood");
for(Object o : sor.getInput()) {
	System.out.println(o);
}
System.out.println(sor.getRecipeOutput());
GameRegistry.addRecipe(sor);

The output was following:

[16:38:34] [Client thread/INFO] [STDOUT]: [com.deerangle.main.ModCrafting:preInit:43]: [1xitem.ingotIron@0]
[16:38:34] [Client thread/INFO] [STDOUT]: [com.deerangle.main.ModCrafting:preInit:43]: null
[16:38:34] [Client thread/INFO] [STDOUT]: [com.deerangle.main.ModCrafting:preInit:43]: [1xitem.ingotIron@0]
[16:38:34] [Client thread/INFO] [STDOUT]: [com.deerangle.main.ModCrafting:preInit:43]: [1xtile.wood@32767]
[16:38:34] [Client thread/INFO] [STDOUT]: [com.deerangle.main.ModCrafting:preInit:43]: 1xitem.null@0
[16:38:34] [Client thread/INFO] [STDOUT]: [com.deerangle.main.ModCrafting:preInit:43]: [1xtile.wood@32767]
[16:38:34] [Client thread/INFO] [STDOUT]: [com.deerangle.main.ModCrafting:preInit:43]: [1xtile.wood@32767]
[16:38:34] [Thread-6/INFO] [FML]: Using sync timing. 200 frames of Display.update took 125382604 nanos
[16:38:34] [Client thread/INFO] [FML]: Applying holder lookups
[16:38:34] [Client thread/INFO] [FML]: Holder lookups applied
[16:38:34] [Client thread/INFO] [FML]: Injecting itemstacks
[16:38:34] [Client thread/INFO] [FML]: Itemstack injection complete
[16:38:34] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[16:38:34] [Client thread/ERROR] [FML]: 
	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
	UCH	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
	UCH	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.3.2511.jar) 
	UCH	Forge{12.18.3.2511} [Minecraft Forge] (forgeSrc-1.10.2-12.18.3.2511.jar) 
	UCE	noahschocolate{1.1.155} [Noah's Chocolate!] (bin) 
	UCH	JEI{3.9.7.260} [Just Enough Items] (jei_1.10.2-3.9.7.260.jar) 
[16:38:34] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[16:38:34] [Client thread/ERROR] [FML]: Caught exception from Noah's Chocolate! (noahschocolate)
java.lang.NullPointerException
	at net.minecraft.item.ItemStack.toString(ItemStack.java:509) ~[forgeSrc-1.10.2-12.18.3.2511.jar:?]
	at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_171]
	at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_171]
	at net.minecraftforge.fml.common.TracingPrintStream.println(TracingPrintStream.java:43) ~[forgeSrc-1.10.2-12.18.3.2511.jar:?]
	at com.deerangle.main.ModCrafting.preInit(ModCrafting.java:43) ~[bin/:?]
	at com.deerangle.main.NoahsChocolate.preinit(NoahsChocolate.java:61) ~[bin/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:618) ~[forgeSrc-1.10.2-12.18.3.2511.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:243) ~[forgeSrc-1.10.2-12.18.3.2511.jar:?]
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221) ~[forgeSrc-1.10.2-12.18.3.2511.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:145) [LoadController.class:?]
	at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:624) [Loader.class:?]
	at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:259) [FMLClientHandler.class:?]
	at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]

The error says, that there is a nullpointer in ItemStack#toString().

Edited by deerangle
Changed code to be correct
Posted

ModItems.CHOCOLATE_BAR seems to be null when you register the recipe. Make sure you;re registering the recipe after you register the items

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

Posted

I just realized that I was using the wrong item. Now i am using ModItems.SCHOKO_INGOT. Still not working. Buti had the same thought too. But how can it be, that in the same function, ModCrafting#preInit(), i have this line, and it works: 

GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.SCHOKO_BLOCK, 1, 2), "AAA", "AAA", "AAA", 'A', new ItemStack(ModItems.SCHOKO_INGOT, 1, 2));

 

(I will update the code at the top to how it is supposed to be. Still not working though)

Posted

Just noticed you're using Blocks.CAULDRON. Cauldrons have their own separate item. Try Items.CAULDRON

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

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.

Announcements



×
×
  • Create New...

Important Information

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