diff --git a/src/main/java/net/Indyuce/mmoitems/api/item/template/MMOItemTemplate.java b/src/main/java/net/Indyuce/mmoitems/api/item/template/MMOItemTemplate.java index e5712591..120ddb6a 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/item/template/MMOItemTemplate.java +++ b/src/main/java/net/Indyuce/mmoitems/api/item/template/MMOItemTemplate.java @@ -194,7 +194,7 @@ public class MMOItemTemplate extends PostLoadObject implements ItemReference { *

* Default is 1 obviously. * - * @deprecated Dont use this method, the Crafted Amount Stat will be deleted in the near future. + * @deprecated Don't use this method, the Crafted Amount Stat will be deleted in the near future. */ @Deprecated public int getCraftedAmount() { @@ -205,8 +205,10 @@ public class MMOItemTemplate extends PostLoadObject implements ItemReference { // Found? if (ofAmount != null) { + int s = SilentNumbers.ceil(ofAmount.calculate(0)); + // Well what does it read - return SilentNumbers.ceil(ofAmount.calculate(0)); + return s; } // No diff --git a/src/main/java/net/Indyuce/mmoitems/api/recipe/MMOItemUIFilter.java b/src/main/java/net/Indyuce/mmoitems/api/recipe/MMOItemUIFilter.java index 5172254a..adb88554 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/recipe/MMOItemUIFilter.java +++ b/src/main/java/net/Indyuce/mmoitems/api/recipe/MMOItemUIFilter.java @@ -199,7 +199,9 @@ public class MMOItemUIFilter implements UIFilter { */ public static void register() { global = new MMOItemUIFilter(); - UIFilterManager.registerUIFilter(global); } + UIFilterManager.registerUIFilter(global); + VanillaMMOItemCountermatch.enable(); + } /** * @return The general instance of this MMOItem UIFilter. diff --git a/src/main/java/net/Indyuce/mmoitems/api/recipe/VanillaMMOItemCountermatch.java b/src/main/java/net/Indyuce/mmoitems/api/recipe/VanillaMMOItemCountermatch.java new file mode 100644 index 00000000..be769020 --- /dev/null +++ b/src/main/java/net/Indyuce/mmoitems/api/recipe/VanillaMMOItemCountermatch.java @@ -0,0 +1,31 @@ +package net.Indyuce.mmoitems.api.recipe; + +import io.lumine.mythic.lib.api.crafting.uifilters.VanillaUIFilter; +import io.lumine.mythic.lib.api.crafting.uimanager.UIFilterCountermatch; +import io.lumine.mythic.lib.api.item.NBTItem; +import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * To make MMOItems not match as vanilla items (bruh) + */ +public class VanillaMMOItemCountermatch implements UIFilterCountermatch { + + /** + * Activates this Counter Match, to prevent MMOItems from matching as vanilla items. + */ + public static void enable() { + + // Activate + VanillaUIFilter.get().addMatchOverride(new VanillaMMOItemCountermatch()); + } + + @Override + public boolean preventsMatching(@NotNull ItemStack itemStack, @Nullable FriendlyFeedbackProvider friendlyFeedbackProvider) { + + // Does it have type? Then cancel lma0 + return NBTItem.get(itemStack).hasType(); + } +}