Jump to content

How do recipes work in 1.12


GiantNuker

Recommended Posts

Before you say "go look it up", here is what I have:

in "src/main/resources/assets/mocakes/recipes" I have "cake_pan.json":

{
  "type": "crafting_shaped",
  "pattern": [
    "# #",
    "###"
  ],
  "key": {
    "#": {
      "item": "minecraft:iron_nugget"
    }
  },
  "result": {
    "item": "mocakes:cake_pan"
  }
}

and "batter_plain.json":

{
  "type": "crafting_shaped",
  "pattern": [
    "ACA",
    "BEB",
    "CDC"
  ],
  "key": {
    "A": {
      "item": "minecraft:milk_bucket"
    },
    "B": {
      "item": "minecraft:sugar"
    },
    "C": {
      "item": "minecraft:wheat"
    },
    "D": {
      "item": "mocakes:cake_pan"
    },
    "E": {
      "item": "minecraft:egg"
    }
  },
  "result": {
    "item": "mocakes:batter_plain"
  }
}

NIETHER items are craftable(they ARE registered though, they appear in tab,)

I know the names are right because:

[19:59:49] [main/INFO] [STDOUT]: [mods.giantnuker.backslash.BackHandler:registerItems:179]: mocakes:cake_pan
[19:59:49] [main/INFO] [STDOUT]: [mods.giantnuker.backslash.BackHandler:registerItems:179]: mocakes:batter_plain

log for my API

 

2017-08-05_20.05.19.png

2017-08-05_20.06.06.png

Link to comment
Share on other sites

Hi,

I am far from being an experienced modder, but I think the crafting type is what is wrong here. You are using

"type": "crafting_shaped"

which is missing a domain name. What happens is: Forge (or Minecraft - not exactly sure what exactly handels the recipes) checks in your mods domain for modid:crafting_shaped which most likely does not exist. You have to use

"type": "minecraft:crafting_shaped"

in this case.

  • Like 1
Link to comment
Share on other sites

On 8/6/2017 at 2:02 AM, Choonster said:

Are there any errors in the log?

[19:33:12] [main/ERROR]: Parsing error loading recipe mopi:crafting
com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Expected name at line 15 column 8 path $.key.S[0].item
	at net.minecraft.util.JsonUtils.gsonDeserialize(SourceFile:494) ~[JsonUtils.class:?]
	at net.minecraft.util.JsonUtils.fromJson(SourceFile:532) ~[JsonUtils.class:?]
	at net.minecraftforge.common.crafting.CraftingHelper.lambda$loadRecipes$21(CraftingHelper.java:699) [CraftingHelper.class:?]
	at net.minecraftforge.common.crafting.CraftingHelper$$Lambda$97/1112485320.apply(Unknown Source) [CraftingHelper.class:?]
	at net.minecraftforge.common.crafting.CraftingHelper.findFiles(CraftingHelper.java:790) [CraftingHelper.class:?]
	at net.minecraftforge.common.crafting.CraftingHelper.loadRecipes(CraftingHelper.java:659) [CraftingHelper.class:?]
	at net.minecraftforge.common.crafting.CraftingHelper$$Lambda$95/2001998233.accept(Unknown Source) [CraftingHelper.class:?]
	at java.util.ArrayList.forEach(ArrayList.java:1249) [?:1.8.0_25]
	at net.minecraftforge.common.crafting.CraftingHelper.loadRecipes(CraftingHelper.java:614) [CraftingHelper.class:?]
	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:779) [Loader.class:?]
	at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:343) [FMLClientHandler.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:534) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:377) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	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_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: com.google.gson.stream.MalformedJsonException: Expected name at line 15 column 8 path $.key.S[0].item
	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[JsonReader.class:?]
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:505) ~[JsonReader.class:?]
	at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414) ~[JsonReader.class:?]
	at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:738) ~[TypeAdapters$29.class:?]
	at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:731) ~[TypeAdapters$29.class:?]
	at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[TypeAdapters$29.class:?]
	at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[TypeAdapters$29.class:?]
	at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:714) ~[TypeAdapters$29.class:?]
	at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:910) ~[TypeAdapters$35$1.class:?]
	at net.minecraft.util.JsonUtils.gsonDeserialize(SourceFile:492) ~[JsonUtils.class:?]
	... 25 more

Not sure what caused it, my recipes are almost exact vanilla copies

Link to comment
Share on other sites

If you get malformed JSON it means that you have something syntactically wrong, like an extra comma or missing brace somewhere. There are websites that can verify that your JSON is valid, and I use a JSON formatter plugin for Eclipse to help me make sure I did it all right. Basically you have a typo, which is easy to do in JSON files. Use a verifier and it will quickly be obvious.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

20 hours ago, jabelar said:

If you get malformed JSON it means that you have something syntactically wrong, like an extra comma or missing brace somewhere. There are websites that can verify that your JSON is valid, and I use a JSON formatter plugin for Eclipse to help me make sure I did it all right. Basically you have a typo, which is easy to do in JSON files. Use a verifier and it will quickly be obvious.

Verivier said it was OK

Link to comment
Share on other sites

Expected name at line 15 column 8 path

 

The json is valid JSON but it's missing a required key entry

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

On 14/08/2017 at 0:36 PM, GiantNuker said:

[19:33:12] [main/ERROR]: Parsing error loading recipe mopi:crafting

com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Expected name at line 15 column 8 path $.key.S[0].item

 

This is a syntax error, not a missing entry.

 

Post the mopi:crafting recipe file.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

1 hour ago, GiantNuker said:

I did not know there had to be a <modid>:crafting json

 

mopi:crafting is expanded to assets/mopi/recipes/crafting.json, the mod ID isn't included in the file name.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

Announcements



×
×
  • Create New...

Important Information

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