@@ -63,6 +63,7 @@ public void addBrewing(ItemStack input, ItemStack ingredient, ItemStack output)
6363 *
6464 * @param ingredient
6565 * the ingredient
66+ * @return true, if the ingredient is a valid potion ingredient.
6667 */
6768 public boolean isPotionIngredient (ItemStack ingredient )
6869 {
@@ -77,15 +78,37 @@ public boolean isPotionIngredient(ItemStack ingredient)
7778 * the input potion
7879 * @param ingredient
7980 * the ingredient
81+ * @return the output
8082 */
8183 public ItemStack getBrewingResult (ItemStack input , ItemStack ingredient )
8284 {
8385 return PotionRecipes .applyIngredient (input , ingredient );
8486 }
8587
88+ /**
89+ * Adds the given {@link PotionEffect} to an {@link NBTTagList} and adds it
90+ * to the given {@link ItemStack}'s NBT.
91+ *
92+ * @param stack
93+ * the potion stack
94+ * @param effect
95+ * the effect
96+ */
97+ public void addEffect (ItemStack stack , PotionEffect effect )
98+ {
99+ PotionTypeList potionTypes = new PotionTypeList (stack );
100+ potionTypes .add (PotionType .getFromEffect (effect ));
101+ potionTypes .save ();
102+ }
103+
86104 /**
87105 * Translates the given {@link List} of {@link PotionEffect}s to an
88106 * {@link NBTTagList} and adds it to the given {@link ItemStack}'s NBT.
107+ *
108+ * @param stack
109+ * the potion stack
110+ * @param effects
111+ * the list of effects
89112 */
90113 public void setEffects (ItemStack stack , List <PotionEffect > effects )
91114 {
@@ -101,11 +124,19 @@ public void setEffects(ItemStack stack, List<PotionEffect> effects)
101124 /**
102125 * Calculates the duration modifier for a potion effect according to the
103126 * given parameters.
127+ *
128+ * @param splash
129+ * true, if the potion is a splash potion
130+ * @param amplifier
131+ * the amplifier
132+ * @param extended
133+ * true, if the potion is extended
134+ * @return the duration multiplier of the potion
104135 */
105- public float getDurationModifier (boolean splash , int amplification , boolean extended )
136+ public float getDurationModifier (boolean splash , int amplifier , boolean extended )
106137 {
107138 float modifier = splash ? 0.75F : 1.0F ;
108- modifier /= 2 << amplification ;
139+ modifier /= 2 << amplifier ;
109140 return extended ? modifier * 8F / 3F : modifier ;
110141 }
111142}
0 commit comments