Compare commits

...

2 Commits

Author SHA1 Message Date
Matteo Planchet 8536837ec9
Add glint from ingredients 2024-03-24 01:25:38 +01:00
Matteo Planchet 900946cbff
Set glint during aging process 2024-03-23 17:33:06 +01:00
2 changed files with 17 additions and 2 deletions

View File

@ -11,6 +11,8 @@ import com.dre.brewery.recipe.RecipeItem;
import com.dre.brewery.recipe.PotionColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.jetbrains.annotations.Nullable;
@ -132,6 +134,9 @@ public class BIngredients {
cookRecipe.getColor().colorBrew(potionMeta, potion, false);
brew.updateCustomModelData(potionMeta);
if (cookRecipe.hasGlint()) {
potionMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
} else {
// new base potion
brew = new Brew(this);
@ -179,6 +184,9 @@ public class BIngredients {
}
brew.save(potionMeta);
potion.setItemMeta(potionMeta);
if (cookRecipe != null && cookRecipe.hasGlint()) {
potion.addUnsafeEnchantment(Enchantment.LURE, 1);
}
P.p.stats.metricsForCreate(false);
return potion;

View File

@ -710,6 +710,10 @@ public class Brew implements Cloneable {
lore.addOrReplaceEffects(getEffects(), quality);
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(quality)));
recipe.getColor().colorBrew(potionMeta, item, canDistill());
if (recipe.hasGlint()) {
potionMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
} else {
quality = 0;
lore.convertLore(false);
@ -749,6 +753,9 @@ public class Brew implements Cloneable {
}
save(potionMeta);
item.setItemMeta(potionMeta);
if (currentRecipe != null && currentRecipe.hasGlint()) {
item.addUnsafeEnchantment(Enchantment.LURE, 1);
}
}
/**
@ -806,8 +813,8 @@ public class Brew implements Cloneable {
recipe.getColor().colorBrew(potionMeta, potion, false);
updateCustomModelData(potionMeta);
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(quality)));
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(quality)));
if (recipe.hasGlint()) {
potionMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);