Search in sources :

Example 1 with AQUA

use of net.minecraft.util.text.TextFormatting.AQUA in project Wynntils by Wynntils.

the class ItemProfile method generateStack.

private ItemStack generateStack() {
    ItemStack stack = itemInfo.asItemStack();
    if (stack.isEmpty())
        return guideStack = ItemStack.EMPTY;
    List<String> itemLore = new ArrayList<>();
    {
        // lore
        if (attackSpeed != null)
            itemLore.add(attackSpeed.asLore());
        itemLore.add(" ");
        if (damageTypes.size() > 0) {
            // damage types
            if (damageTypes.containsKey("neutral"))
                itemLore.add(GOLD + "✣ Neutral Damage: " + damageTypes.get("neutral"));
            if (damageTypes.containsKey("fire"))
                itemLore.add(RED + "✣ Fire" + GRAY + " Damage: " + damageTypes.get("fire"));
            if (damageTypes.containsKey("water"))
                itemLore.add(AQUA + "✣ Water" + GRAY + " Damage: " + damageTypes.get("water"));
            if (damageTypes.containsKey("air"))
                itemLore.add(WHITE + "✣ Air" + GRAY + " Damage: " + damageTypes.get("air"));
            if (damageTypes.containsKey("thunder"))
                itemLore.add(YELLOW + "✣ Thunder" + GRAY + " Damage: " + damageTypes.get("thunder"));
            if (damageTypes.containsKey("earth"))
                itemLore.add(DARK_GREEN + "✣ Earth" + GRAY + " Damage: " + damageTypes.get("earth"));
            itemLore.add(" ");
        }
        if (defenseTypes.size() > 0) {
            // defense types
            if (defenseTypes.containsKey("health"))
                itemLore.add(DARK_RED + "❤ Health: " + getDefenseText("health"));
            if (defenseTypes.containsKey("fire"))
                itemLore.add(RED + "✣ Fire" + GRAY + " Defence: " + getDefenseText("fire"));
            if (defenseTypes.containsKey("water"))
                itemLore.add(AQUA + "✣ Water" + GRAY + " Defence: " + getDefenseText("water"));
            if (defenseTypes.containsKey("air"))
                itemLore.add(WHITE + "✣ Air" + GRAY + " Defence: " + getDefenseText("air"));
            if (defenseTypes.containsKey("thunder"))
                itemLore.add(YELLOW + "✣ Thunder" + GRAY + " Defence: " + getDefenseText("thunder"));
            if (defenseTypes.containsKey("earth"))
                itemLore.add(DARK_GREEN + "✣ Earth" + GRAY + " Defence: " + getDefenseText("earth"));
            itemLore.add(" ");
        }
        // requirements
        if (requirements.hasRequirements(itemInfo.getType())) {
            if (requirements.requiresQuest())
                itemLore.add(GREEN + "✔ " + GRAY + "Quest Req: " + requirements.getQuest());
            if (requirements.requiresClass(itemInfo.getType()))
                itemLore.add(GREEN + "✔ " + GRAY + "Class Req: " + requirements.getRealClass(itemInfo.getType()).getDisplayName());
            if (requirements.getLevel() != 0)
                itemLore.add(GREEN + "✔ " + GRAY + "Combat Lv. Min: " + requirements.getLevel());
            if (requirements.getStrength() != 0)
                itemLore.add(GREEN + "✔ " + GRAY + "Strength Min: " + requirements.getStrength());
            if (requirements.getAgility() != 0)
                itemLore.add(GREEN + "✔ " + GRAY + "Agility Min: " + requirements.getAgility());
            if (requirements.getDefense() != 0)
                itemLore.add(GREEN + "✔ " + GRAY + "Defense Min: " + requirements.getDefense());
            if (requirements.getIntelligence() != 0)
                itemLore.add(GREEN + "✔ " + GRAY + "Intelligence Min: " + requirements.getIntelligence());
            if (requirements.getDexterity() != 0)
                itemLore.add(GREEN + "✔ " + GRAY + "Dexterity Min: " + requirements.getDexterity());
            itemLore.add(" ");
        }
        // ids
        if (statuses.size() > 0) {
            Map<String, String> statusLore = new HashMap<>();
            for (String idName : statuses.keySet()) {
                IdentificationContainer id = statuses.get(idName);
                statusLore.put(idName, getIDLore(id, idName));
            }
            itemLore.addAll(IdentificationOrderer.INSTANCE.order(statusLore, UtilitiesConfig.Identifications.INSTANCE.addSpacing));
            itemLore.add(" ");
        }
        // major ids
        if (majorIds != null && majorIds.size() > 0) {
            for (MajorIdentification majorId : getMajorIds()) {
                Stream.of(StringUtils.wrapTextBySize(majorId.asLore(), 150)).forEach(c -> itemLore.add(DARK_AQUA + c));
            }
            itemLore.add(" ");
        }
        // powders
        if (powderAmount > 0)
            itemLore.add(GRAY + "[" + powderAmount + " Powder Slots]");
        // item tier
        itemLore.add(tier.asLore());
        // untradable
        if (restriction != null)
            itemLore.add(RED + StringUtils.capitalizeFirst(restriction) + " Item");
        // item lore
        if (lore != null && !lore.isEmpty()) {
            itemLore.addAll(McIf.mc().fontRenderer.listFormattedStringToWidth(DARK_GRAY + this.getLore(), 150));
        }
    }
    // updating lore and name
    {
        NBTTagCompound tag = new NBTTagCompound();
        NBTTagCompound display = new NBTTagCompound();
        NBTTagList loreList = new NBTTagList();
        itemLore.forEach(c -> loreList.appendTag(new NBTTagString(c)));
        display.setTag("Lore", loreList);
        // item display name
        display.setString("Name", tier.getTextColor() + displayName);
        // armor color
        if (itemInfo.isArmorColorValid())
            display.setInteger("color", itemInfo.getArmorColorAsInt());
        tag.setTag("display", display);
        // this allow items like reliks to have damage
        tag.setBoolean("Unbreakable", true);
        stack.setTagCompound(tag);
    }
    return guideStack = stack;
}
Also used : DARK_RED(net.minecraft.util.text.TextFormatting.DARK_RED) ItemInfoContainer(com.wynntils.webapi.profiles.item.objects.ItemInfoContainer) AQUA(net.minecraft.util.text.TextFormatting.AQUA) IdentificationContainer(com.wynntils.webapi.profiles.item.objects.IdentificationContainer) McIf(com.wynntils.McIf) HashMap(java.util.HashMap) ItemAttackSpeed(com.wynntils.webapi.profiles.item.enums.ItemAttackSpeed) ItemRequirementsContainer(com.wynntils.webapi.profiles.item.objects.ItemRequirementsContainer) NBTTagString(net.minecraft.nbt.NBTTagString) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) NBTTagList(net.minecraft.nbt.NBTTagList) DARK_GREEN(net.minecraft.util.text.TextFormatting.DARK_GREEN) MajorIdentification(com.wynntils.webapi.profiles.item.objects.MajorIdentification) Locale(java.util.Locale) Map(java.util.Map) DARK_AQUA(net.minecraft.util.text.TextFormatting.DARK_AQUA) UtilitiesConfig(com.wynntils.modules.utilities.configs.UtilitiesConfig) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GOLD(net.minecraft.util.text.TextFormatting.GOLD) EnumMap(java.util.EnumMap) WHITE(net.minecraft.util.text.TextFormatting.WHITE) ClassType(com.wynntils.core.framework.enums.ClassType) DamageType(com.wynntils.core.framework.enums.DamageType) YELLOW(net.minecraft.util.text.TextFormatting.YELLOW) GRAY(net.minecraft.util.text.TextFormatting.GRAY) ItemTier(com.wynntils.webapi.profiles.item.enums.ItemTier) List(java.util.List) StringUtils(com.wynntils.core.utils.StringUtils) Stream(java.util.stream.Stream) RED(net.minecraft.util.text.TextFormatting.RED) GREEN(net.minecraft.util.text.TextFormatting.GREEN) DARK_GRAY(net.minecraft.util.text.TextFormatting.DARK_GRAY) NBTTagList(net.minecraft.nbt.NBTTagList) MajorIdentification(com.wynntils.webapi.profiles.item.objects.MajorIdentification) ArrayList(java.util.ArrayList) IdentificationContainer(com.wynntils.webapi.profiles.item.objects.IdentificationContainer) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NBTTagString(net.minecraft.nbt.NBTTagString) NBTTagString(net.minecraft.nbt.NBTTagString) ItemStack(net.minecraft.item.ItemStack) HashMap(java.util.HashMap) Map(java.util.Map) EnumMap(java.util.EnumMap)

Aggregations

McIf (com.wynntils.McIf)1 ClassType (com.wynntils.core.framework.enums.ClassType)1 DamageType (com.wynntils.core.framework.enums.DamageType)1 StringUtils (com.wynntils.core.utils.StringUtils)1 UtilitiesConfig (com.wynntils.modules.utilities.configs.UtilitiesConfig)1 ItemAttackSpeed (com.wynntils.webapi.profiles.item.enums.ItemAttackSpeed)1 ItemTier (com.wynntils.webapi.profiles.item.enums.ItemTier)1 IdentificationContainer (com.wynntils.webapi.profiles.item.objects.IdentificationContainer)1 ItemInfoContainer (com.wynntils.webapi.profiles.item.objects.ItemInfoContainer)1 ItemRequirementsContainer (com.wynntils.webapi.profiles.item.objects.ItemRequirementsContainer)1 MajorIdentification (com.wynntils.webapi.profiles.item.objects.MajorIdentification)1 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Stream (java.util.stream.Stream)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1