Topic category: User side tutorials
This tutorial will explain how to add brewing recipes, but it'll use custom code
In the images, you might see Object obj =
and obj =
, but they aren't necessary
Before we start...
If you made a custom potion element, make sure to enable the potion effect bottles, or you won't be able to brew them
The actual tutorial
- Start by creating a custom code element. You can remove some parts, because they won't be needed
- Copy these lines of code inside the
init
method, then press ctrl+w:
try { Class clazz = net.minecraft.potion.PotionBrewing.class; Method mth = ObfuscationReflectionHelper.findMethod(clazz, "func_193357_a", Potion.class, Item.class, Potion.class); mth.invoke(null, basePotion, ingredient, resultPotion); // To add more recipes, you can copy the line above, for ex. // mth.invoke(null, potion2, item2, potion3); } catch (Throwable e) { System.err.println("ERROR: " + e); // You can change this part }
The final result should look like this:
-
To actually add a brewing recipe, you'll have to replace
basePotion
andresultPotion
with the starting and resulting potions, andingredient
with an item:-
To add a vanilla potion, type
Potions
, then press ctrl+w. Type.
afterPotions
, and the editor should show you the vanilla potions. For example,Potions.AWKWARD
is the awkward potion, whilePotions.LONG_SWIFTNESS
is the extended potion of speed -
To add your custom potions, type the name of your potion element, followed by
Potion.potionType
, then press ctrl+w. For example, if you made a potion element named "Invincibility", you'll have to typeInvincibilityPotion.potionType
-
To use vanilla items and blocks as an ingredient, type
Items
, then press ctrl+w. Add a.
afterItems
, and the editor should now show you the vanilla items and blocks. For example, to use cobblestone, you'll have to typeItems.COBBLESTONE
, while for redstone dust it'sItems.REDSTONE
-
To use modded items/foods, type the name of your element, followed by
Item.block
, then press ctrl+w. For example, if your item element is named MagicDust, you'll have to typeMagicDustItem.block
-
Finally, to use modded blocks/plants, type
Item.getItemFromBlock()
; inside the (), type the name of your element, followed byBlock.block
, then press ctrl+w. For example, if your block element is named SeaGravel, you'll have to typeItem.getItemFromBlock(SeaGravelBlock.block)
This is what your element should look like after adding a brewing recipe
-
-
To add more brewing recipes, you don't have to create other custom elements. You can copy the line that starts with
mth.invoke
and change the potions and item. For example, here I added another recipe that turns potions of regeneration into thick potions
This is epic, I was making a mod all about potions and then I realized I didn't know how to make a brewing recipe. You saved me.
Is there some way to use this in 1.16.4 beta snapshot MCreator
How to add splash and lingering potions?
Someone can tell me a code that works in 1.16.5?
This is epic. It is better than u give it credit for. Even in 2021.2 snapshots, I'm using this. It solves 3 main problems with the built-in brewing recipes.
1. You can't define specific Potions to be brewed, only Uncraftable empty potions
2. It does not have built-in support for splash/lingering potions
3. It's code is clean
Also another benefit about this that the built-in one does have
Works in 1.16.x :)
So to sum it up
Epic epic pog pog upvote pog
Could you make a 1.16.5 version?
Wow! Thanks a lot! Even though I am in 1.16, it works!