Posted August 13, 20187 yr Hi. How can I configure a recipe JSON to accept items of any damage level? Currently my item damages itself during crafting and then I am unable to use it further. I know I could make one JSON for each damage level (there are only 12) but I am hoping someone might have a more elegant solution to the problem. Any advice is appreciated, and the codes are below. Thanks! Recipe: Spoiler { "type": "minecraft:crafting_shapeless", "ingredients": [ { "item": "qraft:carnyx_sharpener" }, { "item": "qraft:carnyx", "data": 0 } ], "result": { "item": "sharpened_carnyx", "data": 0 } } Carnyx Sharpener: Spoiler package main.java.common.item; import net.minecraft.item.ItemStack; public final class QraftCarnyxSharpener extends QraftItemBase { public QraftCarnyxSharpener() { super("carnyx_sharpener"); setMaxStackSize(1); } @Override public int getMaxDamage() { return 12; } @Override public boolean hasContainerItem(final ItemStack stack) { return true; } @Override public ItemStack getContainerItem(ItemStack stack) { stack = stack.copy(); stack.attemptDamageItem(1, itemRand, null); return stack; } } Edited August 13, 20187 yr by quantumapples clarified title :>
August 13, 20187 yr I believe set data to 32767 in the recipe. About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
August 13, 20187 yr Try putting a data value of 32,767 for your ingredient. 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.
August 13, 20187 yr Author I updated the relevant portion of the recipe: Quote { "item": "qraft:carnyx_sharpener", "data": 32767 }, But in game I put the sharpener and the item in the crafting grid and it will only craft one of them still. I also tried it with a comma in the event that JSON required it and that didn't work either. Is there anything I need to do in the crafting for the sharpener? Any recipe factories I might need or would I need to add it to a recipe group? I appreciate the help
August 13, 20187 yr 17 minutes ago, quantumapples said: I updated the relevant portion of the recipe: But in game I put the sharpener and the item in the crafting grid and it will only craft one of them still. I also tried it with a comma in the event that JSON required it and that didn't work either. Is there anything I need to do in the crafting for the sharpener? Any recipe factories I might need or would I need to add it to a recipe group? I appreciate the help Post your whole recipe json please. 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.
August 13, 20187 yr Author 1 minute ago, Animefan8888 said: Post your whole recipe json please. Sure: Spoiler { "type": "minecraft:crafting_shapeless", "ingredients": [ { "item": "qraft:carnyx_sharpener", "data": 32767 }, { "item": "qraft:carnyx", "data": 0 } ], "result": { "item": "sharpened_carnyx", "data": 0 } } And if it is relevant, here is the recipe for the sharpener itself: Spoiler { "type": "minecraft:crafting_shaped", "pattern": [ "A", "B" ], "key": { "A": [ { "item": "minecraft:iron", "data": 0 } ], "B": [ { "item": "qraft:carnyx", "data": 0 } ] }, "result": { "item": "qraft:carnyx_sharpener", "data": 0 } } Thanks!
August 13, 20187 yr 29 minutes ago, quantumapples said: Sure: I'm not sure why this isn't working for you, and you may want to change. 31 minutes ago, quantumapples said: "item": "sharpened_carnyx", To have your modid I have this which should be similar to your code and it works Spoiler { setMaxStackSize(1); } @Override public int getMaxDamage() { return 12; } @Override public ItemStack getContainerItem(ItemStack itemStack) { ItemStack stack = itemStack.copy(); stack.attemptDamageItem(1, new Random(), null); return stack; } @Override public boolean hasContainerItem(ItemStack stack) { return true; } and { "type": "minecraft:crafting_shapeless", "ingredients": [ { "item": "capacitance:hammer", "data": 32767 }, { "item": "minecraft:iron_ingot", "data": 0 } ], "result": { "item": "minecraft:iron_ingot", "data": 0 } } 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.
August 13, 20187 yr Author 14 minutes ago, Animefan8888 said: I have this which should be similar to your code and it works The last thing that comes to mind for me would be that my class (effectively*) extends item. Does the item need to extend tool for the 32767 to register as 'any damage level'? Thanks for all your help, if I figure it out I'll update with what the issue was. *I have an item base which auto-registers and does other basic stuff, but the item base extends directly from item.
August 13, 20187 yr 2 minutes ago, quantumapples said: The last thing that comes to mind for me would be that my class (effectively*) extends item. Does the item need to extend tool for the 32767 to register as 'any damage level'? No it does not because mine only extends Item. 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.
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.