Fixed issue saying 'Template Data is not Numeric Stat Formula'

This commit is contained in:
Jules 2023-04-01 23:45:50 +02:00
parent 2290fe7066
commit 147df215f8
2 changed files with 4 additions and 7 deletions

View File

@ -11,7 +11,7 @@ import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
import net.Indyuce.mmoitems.ItemStats; import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.Type; import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder; import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem; import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem; import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate; import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
@ -265,7 +265,7 @@ public class MMOItemUIFilter implements UIFilter {
if (dataments.endsWith("}")) { dataments = dataments.substring(0, dataments.length()-1); } } if (dataments.endsWith("}")) { dataments = dataments.substring(0, dataments.length()-1); } }
data = data.replace(" ", "_").replace("-", "_").toUpperCase(); data = data.replace(" ", "_").replace("-", "_").toUpperCase();
MMOItem m = MMOItems.plugin.getMMOItem(MMOItems.plugin.getTypes().get(argument), data); MMOItem m = new MMOItemBuilder(MMOItems.plugin.getTemplates().getTemplate(MMOItems.plugin.getTypes().get(argument), data), 0, null, true).build();
// Find upgrade? // Find upgrade?
if (!dataments.isEmpty()) { if (!dataments.isEmpty()) {
@ -287,11 +287,8 @@ public class MMOItemUIFilter implements UIFilter {
} }
} }
//noinspection ConstantConditions
ItemStackBuilder builder = m.newBuilder();
// Build display NBT and roll // Build display NBT and roll
return builder.buildNBT(true).toItem(); return m.newBuilder().buildNBT(true).toItem();
} }
@NotNull @NotNull

View File

@ -88,7 +88,7 @@ public class MMOItemIngredient extends Ingredient<MMOItemPlayerIngredient> {
public ItemStack generateItemStack(@NotNull RPGPlayer player) { public ItemStack generateItemStack(@NotNull RPGPlayer player) {
// Generate fresh from the template // Generate fresh from the template
MMOItem mmo = template.newBuilder(player).build(); MMOItem mmo = template.newBuilder(player, true).build();
// Build it for display, obviously // Build it for display, obviously
ItemStack item = mmo.newBuilder().build(true); ItemStack item = mmo.newBuilder().build(true);