mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Fixed forDisplay when canceling recipe in station
This commit is contained in:
parent
7f8afdff65
commit
b14f0e590b
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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>";
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user