I would like to use potions in my recipe input, specifically, potions. Potions are differentiated through their NBT tags. Hence, I'll need to use NBT tag in my recipe input to identify the potion to be used in my recipe.
A friend suggested using Forge's NBT Ingredient, however, I could not find any documentation on it. All I managed to find was OreDict Ingredient.
So, could someone point me to the right direction or assist me in getting started?
Here's an example from my mod on how to use certain potions in recipes. You don't actually need any code to do so in 1.12.2, as you now create recipes using .json files in Forge. In that example, the recipe is a potion of harming placed on top of a water bucket. You can find the names for all the other potion types in net.minecraft.potion.PotionType.registerPotionTypes().
Here's an example from my mod on how to use certain potions in recipes. You don't actually need any code to do so in 1.12.2, as you now create recipes using .json files in Forge. In that example, the recipe is a potion of harming placed on top of a water bucket. You can find the names for all the other potion types in net.minecraft.potion.PotionType.registerPotionTypes().
Thx it worked! Next problem, how would I allow both "healing" and "strong_healing" to be used in the same recipe?Either "healing" or "strong_healing" Potions are allowed
Thx it worked! Next problem, how would I allow both "healing" and "strong_healing" to be used in the same recipe? Either "healing" or "strong_healing" Potions are allowed
Apparently, simply copy pasting the same recipe json file, renaming the 2nd file and changing the NBT tag to "strong_healing" works.
I'm not too sure why it works but, is the name of the recipe json file important, like is the name used/referenced anywhere?
Actually, after looking at the Forge documentation on recipes, you can define multiple items for a single key. I don't know if having multiple .json files for a single recipe would cause any issues, but this is a way you could avoid that altogether.
Actually, after looking at the Forge documentation on recipes, you can define multiple items for a single key. I don't know if having multiple .json files for a single recipe would cause any issues, but this is a way you could avoid that altogether.
I see! Man, my eyes must have been sleeping! I totally overlooked that in the documentation! Thanks Geforce! I'll try that!
Hi Geforce, could you possibly repost your example? It leads to a 404 page haha. I'm just trying to make a mod that gives an enchanted book with a specific enchantment.
EDIT: Nevermind, I figured it out! For anyone having the same issue as me, this seems to work.
I tried this, and it seemed to work with any enchanted book. I'm trying to make it so I can only craft something with an item that has a certain nbt tag, but it doesn't seem to be working.
I would like to use potions in my recipe input, specifically, potions. Potions are differentiated through their NBT tags. Hence, I'll need to use NBT tag in my recipe input to identify the potion to be used in my recipe.
A friend suggested using Forge's NBT Ingredient, however, I could not find any documentation on it. All I managed to find was OreDict Ingredient.
So, could someone point me to the right direction or assist me in getting started?
Edit:
Here's an example from my mod on how to use certain potions in recipes. You don't actually need any code to do so in 1.12.2, as you now create recipes using .json files in Forge. In that example, the recipe is a potion of harming placed on top of a water bucket. You can find the names for all the other potion types in net.minecraft.potion.PotionType.registerPotionTypes().
Mapping and Modding rules | Global rules
Thx it worked! Next problem, how would I allow both "healing" and "strong_healing" to be used in the same recipe? Either "healing" or "strong_healing" Potions are allowed
Apparently, simply copy pasting the same recipe json file, renaming the 2nd file and changing the NBT tag to "strong_healing" works.
I'm not too sure why it works but, is the name of the recipe json file important, like is the name used/referenced anywhere?
Actually, after looking at the Forge documentation on recipes, you can define multiple items for a single key. I don't know if having multiple .json files for a single recipe would cause any issues, but this is a way you could avoid that altogether.
Mapping and Modding rules | Global rules
I see! Man, my eyes must have been sleeping! I totally overlooked that in the documentation! Thanks Geforce! I'll try that!
Hmm hold on, that's for shaped recipe. I'm using shapeless recipe. I'm guessing it won't work for shapeless recipes.
Investigating further into vanilla shapeless recipes gave me this:
So I guess it is possible to have different variants of a single item for 1 ingredient.
Applying this to my recipe, it works! I can have either "healing" or "strong_healing" potions in the recipe!
Thanks Geforce!
Hi Geforce, could you possibly repost your example? It leads to a 404 page haha. I'm just trying to make a mod that gives an enchanted book with a specific enchantment.
EDIT: Nevermind, I figured it out! For anyone having the same issue as me, this seems to work.
I tried this, and it seemed to work with any enchanted book. I'm trying to make it so I can only craft something with an item that has a certain nbt tag, but it doesn't seem to be working.
I have tried formatting it every different way, but it never works...
halp.