HomeJavaModsPotion Component
Potion Component
This resource was made entirely by me for the purpose of simplifying any development process involving potions. This resource is designed specifically to be referenced by other developers and make their jobs easier. This resource allows developers to create any kind of potion with any specific effect in as little as one line! It also allows users to dynamically store and manage potions with ease, by providing a custom object named Potion. Here are some examples of it's use:

Code (Java):
// Returns a potion of Absorption
ItemStack absorptionPotion = PotionComponent. GetPotion (Potion. Type. Absorption ) ;

// Creates a dynamic Potion object of Strength
Potion strength = new Potion (Potion. Type. Strength ) ;

// Creates a dynamic Potion object of a Red Splash potion of Regeneration II for 1 minute with Ambient and Particles set to true
Potion regeneration = new Potion (Potion. Type. Regeneration, Potion. State. Splash, 60, 1, true, true, new Potion. Color ( 255, 0, 0 ) ) ;
Colors used in this resource are of a custom, easy to use, Color object within this resource that can be easily converted to and from Bukkit Colors. PotionMeta and ItemStacks can be created from Potion objects for in game use. This resource provides in-line documentation to further explain the features it has.

In order to put is to use, simply put it in the plugins folder of the desired server and reference it in whatever plugin you may be working on.

You may use, redistribute and/or modify this plugin in any manner you want as long as you remember to credit me for my work and do not try to steal any of my credit for the development of this resource. If there are any bugs with it, please let me know.

This is a free resource, but donations are greatly appreciated and do help a lot!

I hope this resource helps you with whatever you may be doing! Have a good day! :)

Further Examples:
Code (Java):
List <PotionEffect > potionEffects = new ArrayList <PotionEffect > ( ) ;
potionEffects. add ( new PotionEffect (PotionEffectType. INCREASE_DAMAGE, 1200, 0 ) ) ;
potionEffects. add ( new PotionEffect (PotionEffectType. SPEED, 1200, 0 ) ) ;
potionEffects. add ( new PotionEffect (PotionEffectType. HEALTH_BOOST, 1200, 0 ) ) ;

player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Absorption ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. BadLuck ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Absorption, 60, 0, true, true, new Potion. Color ( 255, 255, 0 ) ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Absorption, 60, 0, true, true, new Potion. Color ( 0, 0, 255 ) ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Resistance, Potion. State. Splash ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Resistance, Potion. State. Lingering ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Water, Potion. State. Splash, potionEffects ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Water, potionEffects ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Thick, potionEffects ) ) ;
player. getInventory ( ). addItem (PotionComponent. GetPotion (Potion. Type. Awkward, potionEffects ) ) ;
   
Potion water = new Potion (Potion. Type. Water ) ;
Potion absorption = new Potion (Potion. Type. Absorption, Potion. State. Splash, 180, 1, false, false, new Potion. Color ( 0, 255, 0 ) ) ;
Potion glowing = new Potion (Potion. Type. Glowing, Potion. State. Lingering, 180, 1, false, false, new Potion. Color (0x7BFF00 ) ) ;
   
water. AddCustomEffect (Potion. Type. Speed, 300, 2 ) ;
   
player. getInventory ( ). addItem (water. ItemStack ( ) ) ;
player. getInventory ( ). addItem (absorption. ItemStack ( ) ) ;
player. getInventory ( ). addItem (glowing. ItemStack ( ) ) ;
Color changing is not supported below 1.11 and the following effects are not supported in 1.8:

-> Bad Luck
-> Glowing
-> Levitation
-> Luck

I do not currently have a GitHub account, but I plan on making one sometime soon. Then, I will have the source code linked. I am working on a few other projects so I am not sure how long it will be until I get to that. You may use a Java Decompiler for modifying it in the meantime.
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Potion Component is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10, 1.11 and newer. Downloaded 664 times (via Spigot). Download it and open it directly in the game.

Explore more