Jump to content

Recommended Posts

Posted

Hi,

I'm using a method to create a brewing recipe, and it is asking for Ingredient, all I can see from the Ingredient class is to get an item, however, I need to specify a paticular potion, how would I do this?

Posted
2 minutes ago, imacatlolol said:

You can use PotionUtils.addPotionToItemStack, then use the resulting stack as an ingredient.

Okay....

So I have

BrewingRecipeRegistry.addRecipe(Ingredient.fromStacks(PotionUtils.addPotionToItemStack(here, Potions.AWKWARD)));

 

But I'm not sure what to put for 'here' as it wants an ItemStack..

Posted
Just now, modders2 said:

But I'm not sure what to put for 'here' as it wants an ItemStack..

You would create a new item stack of whatever type of potion you're trying to make. Items.POTION, Items.SPLASH_POTION, and Items.LINGERING_POTION are the vanilla ones. You could either do new ItemStack(item) or item#getDefaultInstance() to get a stack of any item.

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Posted
15 minutes ago, imacatlolol said:

You would create a new item stack of whatever type of potion you're trying to make. Items.POTION, Items.SPLASH_POTION, and Items.LINGERING_POTION are the vanilla ones. You could either do new ItemStack(item) or item#getDefaultInstance() to get a stack of any item.

Okay, so I've done this and I have the following:

BrewingRecipeRegistry.addRecipe(Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.AWKWARD)), Ingredient.fromItems(ItemList.PEPPERS.get()), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION),  PotionList.MORE_HEALTH_POTION.get()));

 

Only problem with this, is that I can put one in, and it brews fine, however, putting more than one in will just keep brewing, it is accepting all potions, and overriding them if they aren't the output one

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.

Announcements



×
×
  • Create New...

Important Information

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