From b14f0e590b3b5f2b21d367583243efe06bf36b81 Mon Sep 17 00:00:00 2001 From: Jules Date: Fri, 12 May 2023 19:16:06 +0200 Subject: [PATCH] Fixed forDisplay when canceling recipe in station --- .../mmoitems/api/crafting/ingredient/Ingredient.java | 2 +- .../mmoitems/api/crafting/ingredient/MMOItemIngredient.java | 6 +++--- .../mmoitems/api/crafting/ingredient/VanillaIngredient.java | 2 +- .../net/Indyuce/mmoitems/api/item/build/LoreBuilder.java | 2 +- .../comp/mythicmobs/crafting/MythicItemIngredient.java | 2 +- .../net/Indyuce/mmoitems/gui/CraftingStationPreview.java | 4 ++-- .../java/net/Indyuce/mmoitems/gui/CraftingStationView.java | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/Ingredient.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/Ingredient.java index 5156a6ff..84e9153f 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/Ingredient.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/Ingredient.java @@ -75,7 +75,7 @@ public abstract class Ingredient { * @return The ItemStack to display to the player */ @NotNull - public abstract ItemStack generateItemStack(@NotNull RPGPlayer player); + public abstract ItemStack generateItemStack(@NotNull RPGPlayer player, boolean forDisplay); public CheckedIngredient evaluateIngredient(@NotNull IngredientInventory inv) { return inv.findMatching(this); diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/MMOItemIngredient.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/MMOItemIngredient.java index 43681749..a2787178 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/MMOItemIngredient.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/MMOItemIngredient.java @@ -85,13 +85,13 @@ public class MMOItemIngredient extends Ingredient { @NotNull @Override - public ItemStack generateItemStack(@NotNull RPGPlayer player) { + public ItemStack generateItemStack(@NotNull RPGPlayer player, boolean forDisplay) { // Generate fresh from the template - MMOItem mmo = template.newBuilder(player, true).build(); + MMOItem mmo = template.newBuilder(player, forDisplay).build(); // Build it for display, obviously - ItemStack item = mmo.newBuilder().build(true); + ItemStack item = mmo.newBuilder().build(forDisplay); // Set level lma0 int lvl = SilentNumbers.floor(level.getAsDouble(0)); diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/VanillaIngredient.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/VanillaIngredient.java index 7f12c8e2..b9abafcd 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/VanillaIngredient.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/crafting/ingredient/VanillaIngredient.java @@ -140,7 +140,7 @@ public class VanillaIngredient extends Ingredient { @NotNull @Override - public ItemStack generateItemStack(@NotNull RPGPlayer player) { + public ItemStack generateItemStack(@NotNull RPGPlayer player, boolean forDisplay) { // Stack ItemStack stack = filter.getItemStack(null); diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/item/build/LoreBuilder.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/item/build/LoreBuilder.java index 0dc97c66..c04cf656 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/item/build/LoreBuilder.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/item/build/LoreBuilder.java @@ -158,7 +158,7 @@ public class LoreBuilder { String result; try { - result = MythicLib.plugin.getMMOConfig().decimals.format((double) MythicLib.plugin.getFormulaParser().eval(match)); + result = MythicLib.plugin.getMMOConfig().decimals.format((double) MythicLib.plugin.getInterpreter().eval(match)); } catch (Exception ignored) { result = ""; } diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/comp/mythicmobs/crafting/MythicItemIngredient.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/comp/mythicmobs/crafting/MythicItemIngredient.java index 67c9dcd2..217abbbf 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/comp/mythicmobs/crafting/MythicItemIngredient.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/comp/mythicmobs/crafting/MythicItemIngredient.java @@ -52,7 +52,7 @@ public class MythicItemIngredient extends Ingredient @NotNull @Override - public ItemStack generateItemStack(@NotNull RPGPlayer player) { + public ItemStack generateItemStack(@NotNull RPGPlayer player, boolean forDisplay) { return BukkitAdapter.adapt(mythicitem.generateItemStack(getAmount())); } diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationPreview.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationPreview.java index e5691f02..70ceeb8b 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationPreview.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationPreview.java @@ -54,7 +54,7 @@ public class CraftingStationPreview extends PluginInventory { if (ing.getIngredient().getAmount() > 64) { // Generate new item for display - ItemStack sample = ing.getIngredient().generateItemStack(playerData.getRPG()); + ItemStack sample = ing.getIngredient().generateItemStack(playerData.getRPG(), true); sample.setAmount(64); /* @@ -90,7 +90,7 @@ public class CraftingStationPreview extends PluginInventory { // Not greater than 64, just put it like that. } else { - ingredients.add(ing.getIngredient().generateItemStack(playerData.getRPG())); + ingredients.add(ing.getIngredient().generateItemStack(playerData.getRPG(), true)); } } diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationView.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationView.java index 07fe19b1..9654a4c7 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationView.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/gui/CraftingStationView.java @@ -221,7 +221,7 @@ public class CraftingStationView extends PluginInventory { // Give ingredients back for (Ingredient ingredient : recipeInfo.getRecipe().getIngredients()) - new SmartGive(player).give(ingredient.generateItemStack(playerData.getRPG())); + new SmartGive(player).give(ingredient.generateItemStack(playerData.getRPG(), false)); // Give money back recipe.getConditions()