mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-01 11:11:21 +01:00
Removed use of components
This commit is contained in:
parent
b9b61b1616
commit
b53a21dbe5
@ -1,21 +1,21 @@
|
||||
package net.Indyuce.mmoitems.api.crafting.ingredient;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import io.lumine.mythic.lib.api.crafting.uifilters.VanillaUIFilter;
|
||||
import io.lumine.mythic.lib.api.crafting.uimanager.ProvidedUIFilter;
|
||||
import io.lumine.mythic.lib.api.crafting.uimanager.UIFilterManager;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.LegacyComponent;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackCategory;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackMessage;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ingredient.inventory.VanillaPlayerIngredient;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.FFPMMOItems;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -146,14 +146,15 @@ public class VanillaIngredient extends Ingredient<VanillaPlayerIngredient> {
|
||||
ItemStack stack = filter.getItemStack(null);
|
||||
stack.setAmount(getAmount());
|
||||
|
||||
// Apparently get as NBT Item
|
||||
NBTItem item = NBTItem.get(stack);
|
||||
|
||||
// Then rename (okay)
|
||||
if (displayName != null) { item.setDisplayNameComponent(LegacyComponent.parse(displayName)); }
|
||||
if (displayName != null) {
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setDisplayName(MythicLib.plugin.parseColors(displayName));
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
// Return
|
||||
return item.toItem();
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -242,33 +242,8 @@ public class ItemStackBuilder {
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, fakeModifier);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
NBTItem nbtItem = NBTItem.get(item);
|
||||
|
||||
// Apply item display name using Components for colors
|
||||
// if (mmoitem.hasData(ItemStats.NAME) && meta.hasDisplayName()) {
|
||||
// AdventureUtils.setDisplayName(meta, meta.getDisplayName());
|
||||
// Component displayNameComponent = AdventureUtils.asComponent(meta.getDisplayName()).colorIfAbsent(NamedTextColor.WHITE);
|
||||
// if (displayNameComponent.decorations().isEmpty())
|
||||
// displayNameComponent = displayNameComponent.decoration(TextDecoration.ITALIC, false);
|
||||
// nbtItem.setDisplayNameComponent(displayNameComponent);
|
||||
// }
|
||||
|
||||
// if (meta.hasLore()) {
|
||||
// List<Component> componentLore = new LinkedList<>();
|
||||
// MythicLib.plugin.parseColors(meta.getLore())
|
||||
// .stream()
|
||||
// .peek(component -> System.out.println("Component: " + component))
|
||||
// .map(AdventureUtils::asComponent)
|
||||
// .peek(component -> component.decorations().forEach((textDecoration, state) -> {
|
||||
//
|
||||
// System.out.println("Decoration: " + textDecoration + " State: " + state);
|
||||
// }))
|
||||
// .forEach(componentLore::add);
|
||||
// System.out.println("=========================================\n");
|
||||
// nbtItem.setLoreComponents(componentLore);
|
||||
// }
|
||||
|
||||
return nbtItem.addTag(tags);
|
||||
return NBTItem.get(item).addTag(tags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,6 @@ package net.Indyuce.mmoitems.gui;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.adventure.text.Component;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.LegacyComponent;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.api.crafting.ingredient.CheckedIngredient;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.CheckedRecipe;
|
||||
@ -111,12 +110,14 @@ public class CraftingStationPreview extends PluginInventory {
|
||||
item.setAmount(((CraftingRecipe) recipe.getRecipe()).getOutputAmount());
|
||||
inv.setItem(16, item);
|
||||
}
|
||||
if (recipe.getRecipe() instanceof UpgradingRecipe) {
|
||||
NBTItem nbtItem = NBTItem.get(((UpgradingRecipe) recipe.getRecipe()).getItem().getPreview());
|
||||
nbtItem.setDisplayNameComponent(LegacyComponent.parse(
|
||||
nbtItem.toItem().getItemMeta().getDisplayName() + ChatColor.GREEN + "+1!"));
|
||||
|
||||
inv.setItem(16, nbtItem.toItem());
|
||||
if (recipe.getRecipe() instanceof UpgradingRecipe) {
|
||||
final ItemStack item = ((UpgradingRecipe) recipe.getRecipe()).getItem().getPreview();
|
||||
final ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(item.getItemMeta().getDisplayName() + ChatColor.GREEN + "+1!");
|
||||
item.setItemMeta(itemMeta);
|
||||
|
||||
inv.setItem(16, item);
|
||||
}
|
||||
|
||||
inv.setItem(10, ConfigItems.BACK.getItem());
|
||||
|
@ -8,11 +8,6 @@ import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import io.lumine.mythic.lib.util.AdventureUtils;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
<<<<<<<<< Temporary merge branch 1
|
||||
=========
|
||||
import net.Indyuce.mmoitems.util.ColorUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
>>>>>>>>> Temporary merge branch 2
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.edition.NewItemEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
|
@ -1,9 +1,7 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.comp.adventure.AdventureParser;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemTier;
|
||||
|
Loading…
Reference in New Issue
Block a user