Jump to content

[1.10.2] [SOLVED] Specifying potions in recipes?


T-10a

Recommended Posts

Hello, I'd like to find out how to specify a potion in a recipe (i.e. make a Shaped Recipe use a Healing I potion and a few other things, but no other potion is used.). I do know how to make & register normal shaped & shapeless recipes.

If I'm asking a whole bunch of questions, please don't get angry. I'm trying to learn.

Link to comment
Share on other sites

Instead of using an Item or a Block use an ItemStack and i believe it is metadata, if not it is nbt.

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.

Link to comment
Share on other sites

Instead of using an Item or a Block use an ItemStack and i believe it is metadata, if not it is nbt.

 

Potions use nbt to differentiate between types. Unfortunately, I don't think vanilla recipes check an ItemStack's NBT data when checking if a recipe is valid, so you're probably going to have to make your own IRecipe class. (Although it shouldn't be that hard. Pretty much exactly the same as ShapedRecipe, just override ShapedRecipe#checkMatch to check for NBT data as well). Minecraft nicely provides PotionUtils, which has a method called getPotionFromItem that you can use to check a given ItemStack's potion type against the one you desire.

Link to comment
Share on other sites

I found how to use specific potions in recipes. I used TheMasterGabriel's method, by using PotionUtils.

Example code for future googlers:

new PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.STRONG_HEALING));

  • Like 2

If I'm asking a whole bunch of questions, please don't get angry. I'm trying to learn.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.