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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I have this same problem. Did you manage to find a solution? Any help would be appreciated. Thanks.
    • log: https://mclo.gs/QJg3wYX as stated in the title, my game freezes upon loading into the server after i used a far-away waystone in it. The modpack i'm using is better minecraft V18. Issue only comes up in this specific server, singleplayer and other servers are A-okay. i've already experimented with removing possible culprits like modernfix and various others to no effect. i've also attempted a full reinstall of the modpack profile. Issue occurs shortly after the 'cancel' button dissapears on the 'loading world' section of the loading screen.   thanks in advance.
    • You would have better results asking a more specific question. What have you done? What exactly do you need help with? Please also read the FAQ regarding posting logs.
    • Hi, this is my second post with the same content as no one answered this and it's been a long time since I made the last post, I want to make a client-only mod, everything is ok, but when I use shaders, none of the textures rendered in RenderLevelStageEvent nor the crow entity model are rendered, I want them to be visible, because it's a horror themed mod I've already tried it with different shaders, but it didn't work with any of them and I really want to add support for shaders Here is how i render the crow model in the CrowEntityRenderer<CrowEntity>, by the time i use this method, i know is not the right method but i don't think this is the cause of the problem, the renderType i'm using is entityCutout @Override public void render(CrowEntity p_entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { super.render(p_entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); ClientEventHandler.getClient().crow.renderToBuffer(poseStack, bufferSource.getBuffer(ClientEventHandler.getClient().crow .renderType(TEXTURE)), packedLight, OverlayTexture.NO_OVERLAY, Utils.rgb(255, 255, 255)); } Here renderLevelStage @Override public void renderWorld(RenderLevelStageEvent e) { horrorEvents.draw(e); } Here is how i render every event public void draw(RenderLevelStageEvent e) { for (HorrorEvent event : currentHorrorEvents) { event.tick(e.getPartialTick()); event.draw(e); } } Here is how i render the crow model on the event @Override public void draw(RenderLevelStageEvent e) { if(e.getStage() == RenderLevelStageEvent.Stage.AFTER_ENTITIES) { float arcProgress = getArcProgress(0.25f); int alpha = (int) Mth.lerp(arcProgress, 0, 255); int packedLight = LevelRenderer.getLightColor(Minecraft.getInstance().level, blockPos); VertexConsumer builder = ClientEventHandler.bufferSource.getBuffer(crow); Crow<CreepyBirdHorrorEvent> model = ClientEventHandler .getClient().crow; model.setupAnim(this); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, packedLight, OverlayTexture.NO_OVERLAY, alpha); builder = ClientEventHandler.bufferSource.getBuffer(eyes); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, 15728880, OverlayTexture.NO_OVERLAY, alpha); } } How i render the model public static void renderModelInWorld(Model model, Vector3f pos, Vector3f offset, Camera camera, PoseStack matrix, VertexConsumer builder, int light, int overlay, int alpha) { matrix.pushPose(); Vec3 cameraPos = camera.getPosition(); double finalX = pos.x - cameraPos.x + offset.x; double finalY = pos.y - cameraPos.y + offset.y; double finalZ = pos.z - cameraPos.z + offset.z; matrix.pushPose(); matrix.translate(finalX, finalY, finalZ); matrix.mulPose(Axis.XP.rotationDegrees(180f)); model.renderToBuffer(matrix, builder, light, overlay, Utils .rgba(255, 255, 255, alpha)); matrix.popPose(); matrix.popPose(); } Thanks in advance
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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