Custom Potion Duration (TUTORIAL)

Started by Lakas on

Topic category: User side tutorials

Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom Potion Duration (TUTORIAL)

This is a very easy one and takes less than a couple of minutes to do. There's technically only one step you need to do. So, if you want to set the duration of your potion (which I assume you would because you clicked on this topic) simply edit the code of your potion and search for the line "public static class PotionTypeCustom extends PotionType". Under that line you'll see these lines:

 

public PotionTypeCustom() {
            super(new PotionEffect[]{new PotionEffect(potion, 3600)});
            setRegistryName("<YourCustomPotionsName>");

 

What you need to edit is "3600" that's how long your potion lasts in mc ticks.  20 mc ticks = 1 second, so 1 minute = 1200, 2 minutes = 2400 and so on. And there we go you have your custom duration. Remember to lock your elements code so it won't get overwritten!

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yah, but you can just create…
Sun, 08/18/2019 - 05:21

Yah, but you can just create a food that gives the effect

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
no cause then you won't get…
Thu, 09/05/2019 - 17:20

no cause then you won't get a splash potion, tipped arrow and more...

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
well at least you can have…
Fri, 09/06/2019 - 10:04

well at least you can have the normal one...