Invilis Posted April 30, 2020 Posted April 30, 2020 (edited) I have a class for an Item (in this case it extends ArmorItem) with some boolean values. I want to have a recipe that will switch these boolean values, and it depends on the actual Items in the recipe. The main Item is something like a piece of armor, the other is some item that will change the properties of the armor (through the use of the booleans) but keep everything else: durability, enchantments, ect. I am realizing the class will only be instantiated once for all ItemStacks of this Item, so I suppose I would need to store the information in the ItemStack NBT data or something, but I still need to do something when the crafting takes place. I'm fairly certain the json recipes won't do anything like this, so I need to have it in code. How can this be done? In the future, for Minecraft 1.16+, I would like to use the smithing table in sort of the same way where the item is upgraded but I don't want another Item, the Item will be the same because there will be many variations and they won't be that much different. Edited April 30, 2020 by Invilis Quote
Niprow Posted April 30, 2020 Posted April 30, 2020 this should help: Quote I will make fun of you if you are not able to look into the (vanilla-) code.
Invilis Posted April 30, 2020 Author Posted April 30, 2020 (edited) That's good, but not quite there yet. I need some way to tell what Item I am using in the recipe because it will have a specific effect. Using getContainerItem I can change the resulting Item but I need the change to depend on what the secondary Item was. The only thing I can think of is to make a custom crafting table block, that way I could have complete control over the ItemStacks involved, at least that's my theory. A game theory. Edited May 1, 2020 by Invilis Quote
superminerJG Posted May 1, 2020 Posted May 1, 2020 I believe you'll need to subclass net.minecraft.item.crafting.SpecialRecipe to create a special crafting recipe (look at ArmorDyeRecipe) Then you need to register a recipe serializer for said SpecialRecipe. Quote
Recommended Posts
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.