Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5 official mapping] Specifying potion in recipe builder (Solved)


reasure
 Share

Recommended Posts

How can I specify potions in recipes?

ShapelessRecipeBuilder.shapeless(ModItems.POSION_APPLE.get())
                .requires(Items.APPLE)
                .requires(Ingredient.of(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.POISON)))
                .unlockedBy("has_item", has(Items.APPLE))
                .save(consumer);

It's not work
 

Edited by reasure
Link to comment
Share on other sites

ShapelessRecipeBuilder.shapeless(ModItems.POISON_APPLE.get())
                .requires(Items.APPLE)
                .requires(NBTIngredient.of(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.POISON)))
                .unlockedBy("has_item", has(Items.APPLE))
                .save(consumer);

It's not work too

Link to comment
Share on other sites

{
  "type": "minecraft:crafting_shapeless",
  "ingredients": [
    {
      "item": "minecraft:apple"
    },
    {
      "item": "minecraft:potion"
    }
  ],
  "result": {
    "item": "reasurecraft:poison_apple"
  }
}

Here is Json file

Link to comment
Share on other sites

NBTIngredient doesn't have an of method itself, you're actually calling Ingredient.of. You need to create an instance of NBTIngredient directly (or a class that extends it, since the constructor is protected).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

12 minutes ago, Choonster said:

NBTIngredient doesn't have an of method itself, you're actually calling Ingredient.of. You need to create an instance of NBTIngredient directly (or a class that extends it, since the constructor is protected).

Ah, of course.

And this is why you do not ignore your IDE's warnings.

Link to comment
Share on other sites

  • reasure changed the title to [1.16.5 official mapping] Specifying potion in recipe builder (Solved)
Posted (edited)
{
  "type": "minecraft:crafting_shapeless",
  "ingredients": [
    {
      "item": "minecraft:apple"
    },
    {
      "type": "forge:nbt",
      "item": "minecraft:potion",
      "count": 1,
      "nbt": "{Potion:\"minecraft:poison\"}"
    }
  ],
  "result": {
    "item": "reasurecraft:poison_apple"
  }
}

It worked! Thank you!!!

Edited by reasure
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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.