Hi!
I'm making a Minecraft adventure map. In said map, I want to be able to combine (craft) three key parts (amethyst shard) together to form a single, complete key (amethyst cluster). I'm running Minecraft Java Edition 1.20.6.
This is my JSON file:
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"X",
"X",
"X"
],
"key": {
"X": {
"item": "minecraft:amethyst_shard"
}
},
"result": {
"id": "minecraft:amethyst_cluster",
"count": 1,
"components": {
"minecraft:enchantment_glint_override": true,
"minecraft:item_name": "Crystal Key",
"minecraft:lore": ["This could be my ticket out of here..."]
}
}
}
If I change the value of result/components/minecraft:item_name and result/components/minecraft:lore to anything without a space in it, it works perfectly fine:
If I try changing these values to be arrays of strings (so for example ["Crystal", "Key"], then
The item_name throws a JSON parsing error, saying that the value should be a string, not an array:
Parsing error loading recipe custom_recipes:amethyst_cluster com.google.gson.JsonParseException: Not a string: ["Crystal", "Key"] missed input: {"minecraft:item_name":["Crystal","Key"]}
The lore part works, but every element of the array forms a new line when looking at it in my inventory (every word is in a new line). This is not ideal.
This is the exact error message I get:
If the item_name has a space:
Parsing error loading recipe custom_recipes:amethyst_cluster com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 5 path $ missed input: {"minecraft:item_name":"Crystal Key"}
If the lore has a space:
Parsing error loading recipe custom_recipes:amethyst_cluster com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $ missed input: {"minecraft:lore":["Some text with spaces"]}
Can anyone please tell me how to fix this?
I've read on some forums that it shouldn't even be possible to include custom data in crafting recipe ingredients/outputs, but it seems to be working, as long as I don't use spaces in their values. Is there some workaround for this?
It mentions this as an optional element of crafting_shaped/result:
components: Optional. Additional information about the item. See item components.
Following that link, you may find this component listed:
minecraft:item_name: The default name of this item, as a JSON text component. See Raw JSON text format. Unlike the custom_name component, this name cannot be changed through an anvil, and does not show in some labels, such as banner markers and item frames.
I think this "Raw JSON text format" is the wiki page I need, but I'm not sure what to make of it yet...
Hi!
I'm making a Minecraft adventure map. In said map, I want to be able to combine (craft) three key parts (amethyst shard) together to form a single, complete key (amethyst cluster). I'm running Minecraft Java Edition 1.20.6.
This is my JSON file:
If I change the value of result/components/minecraft:item_name and result/components/minecraft:lore to anything without a space in it, it works perfectly fine:
If I try changing these values to be arrays of strings (so for example ["Crystal", "Key"], then
This is the exact error message I get:
Can anyone please tell me how to fix this?
I've read on some forums that it shouldn't even be possible to include custom data in crafting recipe ingredients/outputs, but it seems to be working, as long as I don't use spaces in their values. Is there some workaround for this?
Thank you!
Update:
I found this wiki page.
It mentions this as an optional element of crafting_shaped/result:
Following that link, you may find this component listed:
I think this "Raw JSON text format" is the wiki page I need, but I'm not sure what to make of it yet...