Custom Potion Duration (TUTORIAL)

Started by Lakas on Sat, 08/10/2019 - 17:16

Topic category: User side tutorials

Last seen on 13:20, 17. Nov 2019
Joined Dec 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Custom Potion Duration (TUTORIAL)
Sat, 08/10/2019 - 17:16

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!

Last seen on 03:33, 19. Nov 2019
Joined Jun 2019
User points:

Statistics:

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

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

Last seen on 17:41, 27. Oct 2019
Joined Feb 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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...

Last seen on 03:33, 19. Nov 2019
Joined Jun 2019
User points:

Statistics:

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

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