How do i add custom potions to a loot table

Started by kolokythi on

Topic category: Advanced modding

Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do i add custom potions to a loot table

So I'm making a block that can drop custom potions but I don't know how to find them or make a recipe for them the only one i found was the regular potion however I have no way to add a recipe for the splash arrow and lingering potion nor can i add them to a custom tab or loot table so how do I do it

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
As far as I can tell, ya can…
Mon, 06/03/2024 - 15:37

As far as I can tell, ya can't do potion recipes without some pretty significant custom code. If it's a custom crafting block, it might be possible, but if you're trying to do a vanilla recipe with potion effects, I'm not sure where you'd start.

Loot tables are a bit easier, it's just a loot function. So you'd make your custom loot table using the basic potion item, lock the loot table, and then go into the code and add this to the functions, using your desired potion effect. It should look something like this:

{
          "type": "minecraft:item",
          "name": "minecraft:potion",
          "weight": 1,
          "functions": [
            {
              "function": "set_count",
              "count": {
                "min": 1,
                "max": 1
              }
            },
            {
              "function": "set_nbt",
              "tag": "{Potion:\"minecraft:regeneration\"}"
            }
          ]
        },

Microsoft has a pretty good guide on this, it's technically for bedrock modding, but the formats are mostly the same.