Posted July 18, 20187 yr There are currently two methods , the JSON one and the original hardcoded one. I wonder which shall I use and how to use?
July 18, 20187 yr In 1.12+, you should always be using JSON for regular crafting recipes. McJty has a good doc about it here: https://wiki.mcjty.eu/modding/index.php?title=Recipes-1.12 including creating custom recipes (e.g. copying NBT from an ingredient to the result).
July 18, 20187 yr Author 1 minute ago, desht said: In 1.12+, you should always be using JSON for regular crafting recipes. McJty has a good doc about it here: https://wiki.mcjty.eu/modding/index.php?title=Recipes-1.12 including creating custom recipes (e.g. copying NBT from an ingredient to the result). Thanks
July 18, 20187 yr 14 minutes ago, Arkyo said: which shall I use Depends on what you want to do. It is generally recommended to use json recipes whenever possible since you get: No ~1000line-long classes that register various recipes but instead each recipe is neatly in it's own file. Easy to edit anytime you want without having to spend minutes trying to search for that one line that defines the recipe Any pack maker can easily alter your recipe with a datapack(1.13). No specific recipe-altering mods required. The _constants file. In it you can easily define a constant that corresponds to an item. Or to multiple items. Or to an oredict enty. Or to both. Here is an example of me using one constant to handle differently named oredict entries. While you kinda can do the same with hardcoded recipes it's not as intuitive and easy as just writing a couple of files in your json. If something goes wrong with a json recipe the game will kindly provide a log of what went wrong. If something goes wrong with a hardcoded recipe - it just will be missing from the game with no indication as to why. You will need all your recipes to be json recipes for 1.13 anyway. However for some complex recipes you will need to use "hardcoded" IRecipe implementation. An example of that would be leather armor dyeing or firework making. There is however a point to be made that even custom IRecipe implementations can still be registered with json as I do here and here. 14 minutes ago, Arkyo said: how to use If you are using json recipes simply create a recipes folder in your assets/modid folder. All json recipes will then go there. Here is a minecraftwiki page with a description of the format and here is the examples I used myself provided by Lex. If you are using in-code registration subscribe to RegistryEvent.Register<IRecipe> and use event.getRegistry().register to register your recipes. Do not forget to give them a registry name!
July 18, 20187 yr Author 12 minutes ago, V0idWa1k3r said: Depends on what you want to do. It is generally recommended to use json recipes whenever possible since you get: No ~1000line-long classes that register various recipes but instead each recipe is neatly in it's own file. Easy to edit anytime you want without having to spend minutes trying to search for that one line that defines the recipe Any pack maker can easily alter your recipe with a datapack(1.13). No specific recipe-altering mods required. The _constants file. In it you can easily define a constant that corresponds to an item. Or to multiple items. Or to an oredict enty. Or to both. Here is an example of me using one constant to handle differently named oredict entries. While you kinda can do the same with hardcoded recipes it's not as intuitive and easy as just writing a couple of files in your json. If something goes wrong with a json recipe the game will kindly provide a log of what went wrong. If something goes wrong with a hardcoded recipe - it just will be missing from the game with no indication as to why. You will need all your recipes to be json recipes for 1.13 anyway. However for some complex recipes you will need to use "hardcoded" IRecipe implementation. An example of that would be leather armor dyeing or firework making. There is however a point to be made that even custom IRecipe implementations can still be registered with json as I do here and here. If you are using json recipes simply create a recipes folder in your assets/modid folder. All json recipes will then go there. Here is a minecraftwiki page with a description of the format and here is the examples I used myself provided by Lex. If you are using in-code registration subscribe to RegistryEvent.Register<IRecipe> and use event.getRegistry().register to register your recipes. Do not forget to give them a registry name! Thanks for the reply! However my recipe still doesn't work... { "type": "minecraft:crafting_shapeless", "ingredient": {"item": "minecraft:lever"}, "result": { "item": "openscriptie:bit" } } Also, is there anyway to specify number of ingredients in a single slot? Edited July 18, 20187 yr by Arkyo
July 18, 20187 yr 11 minutes ago, Arkyo said: number of ingredients in a single slot? No, vanilla crafting recipes do not work in this manner.'=' 11 minutes ago, Arkyo said: However my recipe still doesn't work... What does the log say? Also did you even take a look at mcjty's tutorial? You're missing the key and pattern tag. Edited July 18, 20187 yr by Animefan8888 VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 2 minutes ago, Animefan8888 said: No, vanilla crafting recipes do not work in this manner.'=' What does the log say? latest.log
July 18, 20187 yr 1 minute ago, Arkyo said: What does the log say? There is no reference to your recipe in the log, where is the json file located, and 4 minutes ago, Animefan8888 said: Also did you even take a look at mcjty's tutorial? You're missing the key and pattern tag. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 2 minutes ago, Animefan8888 said: There is no reference to your recipe in the log, where is the json file located, and I am using shapeless recipe, so no keys and patterns needed (?) it is located as assets/openscripties/recipe/lever_to_bit.json Edited July 18, 20187 yr by Arkyo
July 18, 20187 yr 5 minutes ago, Arkyo said: I am using shapeless recipe it is located as assets/openscripties/recipe/lever_to_bit.json That should be assets/<modid>/recipes/<filename>.json - "recipes", not "recipe"
July 18, 20187 yr Author 2 minutes ago, desht said: That should be assets/<modid>/recipes/<filename>.json - "recipes", not "recipe" Thanks , changed to recipes , still failed.
July 18, 20187 yr 10 minutes ago, Animefan8888 said: You're missing the key and pattern tag. Those are for shaped recipes, OP is using a shapeless one. 18 minutes ago, Arkyo said: { "type": "minecraft:crafting_shapeless", "ingredient": { "item": "minecraft:lever" }, "result": { "item": "openscriptie:bit" } } Shapeless recipes specify their ingredients as a json array named ingredients. Additionally if the item has subtypes the "data" key must also be provided(data is metadata)
July 18, 20187 yr Just now, V0idWa1k3r said: Those are for shaped recipes, OP is using a shapeless one. 7 minutes ago, Arkyo said: I am using shapeless recipe, so no keys and patterns needed (?) VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author { "type": "minecraft:crafting_shapeless", "ingredients": [ { "item": "minecraft:lever" }], "result": { "item": "openscriptie:bit" } } Failed
July 18, 20187 yr 21 minutes ago, Arkyo said: Failed Is there an error in the log? Its most likely the ingredients being an array of objects instead of an array of strings. Edited July 18, 20187 yr by Animefan8888 VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 8 minutes ago, Animefan8888 said: Is there an error in the log? Its most likely the ingredients being an array of objects instead of an array of strings. I found an interesting thing recipes seems to be completely ignored [20:39:35] [main/TRACE] [FML]: Recursing into package assets [20:39:35] [main/TRACE] [FML]: Recursing into package assets/openscriptie [20:39:35] [main/TRACE] [FML]: Recursing into package assets/openscriptie/lang [20:39:35] [main/TRACE] [FML]: Recursing into package assets/openscriptie/models [20:39:35] [main/TRACE] [FML]: Recursing into package assets/openscriptie/models/item [20:39:35] [main/TRACE] [FML]: Recursing into package assets/openscriptie/textures [20:39:35] [main/TRACE] [FML]: Recursing into package assets/openscriptie/textures/items [20:39:35] [main/TRACE] [FML]: Recursing into package chingdim [20:39:35] [main/TRACE] [FML]: Recursing into package chingdim/OpenScriptie [20:39:35] [main/TRACE] [FML]: Recursing into package chingdim/OpenScriptie/eventhandler [20:39:35] [main/TRACE] [FML]: Recursing into package chingdim/OpenScriptie/item
July 18, 20187 yr 11 minutes ago, Arkyo said: I found an interesting thing recipes seems to be completely ignored 24 minutes ago, Animefan8888 said: Is there an error in the log? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr 1 minute ago, Arkyo said: No error Your path is assets/openscripties/recipes not assets/openscriptie/recipes VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 4 minutes ago, Animefan8888 said: Your path is assets/openscripties/recipes not assets/openscriptie/recipes My mistake , modid is openscriptie , no s Changed ingredients to array of string , failed Edited July 18, 20187 yr by Arkyo
July 18, 20187 yr Just now, Arkyo said: Changed ingredients to array of string , failed Change it back, that was my mistake as noted by me striking out the text. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 14 minutes ago, Animefan8888 said: Change it back, that was my mistake as noted by me striking out the text. Done , and of course still failed
July 18, 20187 yr Just now, Arkyo said: Done , and of course still failed Post updated json and path as well as the log. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 5 minutes ago, Animefan8888 said: Post updated json and path as well as the log. lol , just found a wrong path issue , resolved and now recipe shows. Thank you so much for following up on my case!
July 18, 20187 yr Yeah, the "problem" with the JSON asset system is that you have to get everything exactly right and if you don't there isn't always a lot of good warning on exactly what is wrong. For actual Java code, your IDE (like Eclipse) will warn you instantly of references to non-recognizable things, misspellings, wrongly formatted code. But for JSON you have to usually do a lot more manual checking -- is path exactly right, is filename exactly right, is the file a properly formed JSON, are the values in the JSON exactly right. Once you're used to the amount of detail required though you'll pay attention and also have some common ideas on where to look to fix problems that arise. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.