From 0198698fa3bfadeb6c14658dd4703359339cee97 Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR Date: Sun, 25 Aug 2024 18:17:15 -0300 Subject: [PATCH] Also cache the potion item meta too --- .../gmail/nossr50/datatypes/skills/alchemy/AlchemyPotion.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/AlchemyPotion.java b/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/AlchemyPotion.java index 9b01f50cd..01a9cffd8 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/AlchemyPotion.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/AlchemyPotion.java @@ -19,6 +19,7 @@ import static java.util.Objects.requireNonNull; public class AlchemyPotion { private final @NotNull String potionConfigName; private final @NotNull ItemStack potionItemStack; + private final @NotNull ItemMeta potionItemMeta; private final @NotNull Map alchemyPotionChildren; public AlchemyPotion(@NotNull String potionConfigName, @NotNull ItemStack potionItemStack, @@ -26,6 +27,7 @@ public class AlchemyPotion { this.potionConfigName = requireNonNull(potionConfigName, "potionConfigName cannot be null"); this.potionItemStack = requireNonNull(potionItemStack, "potionItemStack cannot be null"); this.alchemyPotionChildren = requireNonNull(alchemyPotionChildren, "alchemyPotionChildren cannot be null"); + this.potionItemMeta = potionItemStack.getItemMeta(); // The potion item meta should never be null because it is a potion } public @NotNull ItemStack toItemStack(int amount) { @@ -120,7 +122,7 @@ public class AlchemyPotion { } public PotionMeta getAlchemyPotionMeta() { - return (PotionMeta) potionItemStack.getItemMeta(); + return (PotionMeta) potionItemMeta; } public boolean isSplash() {