[TUTORIAL] Custom brewing recipes (1.14/1.15)

Started by SomeoneElse on Thu, 07/02/2020 - 12:46

Topic category: User side tutorials

Last seen on 19:23, 6. Jul 2020
Joined Nov 2017
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[TUTORIAL] Custom brewing recipes (1.14/1.15)
Mon, 07/06/2020 - 18:56 (edited)

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
 

Check if the bottles are enabled!

The actual tutorial

  1. Start by creating a custom code element. You can remove some parts, because they won't be neededA new custom code element

     

  2. 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:
     

    Code after pasting

     

  3. To actually add a brewing recipe, you'll have to replace basePotion and resultPotion with the starting and resulting potions, and ingredient with an item:

    • To add a vanilla potion, type Potions , then press ctrl+w. Type . after Potions, and the editor should show you the vanilla potions. For example, Potions.AWKWARD is the awkward potion, while Potions.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 type InvincibilityPotion.potionType

    • To use vanilla items and blocks as an ingredient, type Items, then press ctrl+w. Add a . after Items, and the editor should now show you the vanilla items and blocks. For example, to use cobblestone, you'll have to type Items.COBBLESTONE, while for redstone dust it's Items.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 type MagicDustItem.block

    • Finally, to use modded blocks/plants, type Item.getItemFromBlock(); inside the (), type the name of your element, followed by Block.block, then press ctrl+w. For example, if your block element is named SeaGravel, you'll have to type Item.getItemFromBlock(SeaGravelBlock.block)

      This is what your element should look like after adding a brewing recipe

      After adding one recipe

       

  4. 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

    Adding a second brewing recipe

     

 

Edited by SomeoneElse on Mon, 07/06/2020 - 18:56
Last seen on 02:41, 8. Aug 2020
Joined Jun 2017
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Can you add Brewing Recipe…
Thu, 07/02/2020 - 13:54

Can you add Brewing Recipe with this, Klemen?

Last seen on 00:20, 30. Jul 2020
Joined Jun 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
this is super helpful  
Thu, 07/02/2020 - 23:16

this is super helpful

 

Last seen on 20:05, 8. Aug 2020
Joined Jul 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
not work :(
Sat, 07/25/2020 - 17:15

not work :(