use of net.minecraft.util.text.TextFormatting.YELLOW 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;
}
Aggregations