Fixed forDisplay when canceling recipe in station

This commit is contained in:
Jules 2023-05-12 19:16:06 +02:00
parent 7f8afdff65
commit b14f0e590b
7 changed files with 10 additions and 10 deletions

View File

@ -75,7 +75,7 @@ public abstract class Ingredient<C extends PlayerIngredient> {
* @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);

View File

@ -85,13 +85,13 @@ public class MMOItemIngredient extends Ingredient<MMOItemPlayerIngredient> {
@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));

View File

@ -140,7 +140,7 @@ public class VanillaIngredient extends Ingredient<VanillaPlayerIngredient> {
@NotNull
@Override
public ItemStack generateItemStack(@NotNull RPGPlayer player) {
public ItemStack generateItemStack(@NotNull RPGPlayer player, boolean forDisplay) {
// Stack
ItemStack stack = filter.getItemStack(null);

View File

@ -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 = "<InvalidFormula>";
}

View File

@ -52,7 +52,7 @@ public class MythicItemIngredient extends Ingredient<MythicItemPlayerIngredient>
@NotNull
@Override
public ItemStack generateItemStack(@NotNull RPGPlayer player) {
public ItemStack generateItemStack(@NotNull RPGPlayer player, boolean forDisplay) {
return BukkitAdapter.adapt(mythicitem.generateItemStack(getAmount()));
}

View File

@ -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));
}
}

View File

@ -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()