use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.
the class ItemChaosGem method clAddInformation.
@Override
public void clAddInformation(ItemStack stack, World world, List list, boolean advanced) {
LocalizationHelper loc = SilentGems.localizationHelper;
for (Entry<ChaosBuff, Integer> entry : getBuffs(stack).entrySet()) list.add(TextFormatting.GOLD + entry.getKey().getLocalizedName(entry.getValue()));
int slotsUsed = getSlotsUsed(stack);
int totalDrain = getTotalChargeDrain(stack, SilentGems.proxy.getClientPlayer());
list.add(loc.getItemSubText(itemName, "charge", getCharge(stack), getMaxCharge(stack)));
list.add(loc.getItemSubText(itemName, "slots", slotsUsed, MAX_SLOTS));
list.add(loc.getItemSubText(itemName, "drain", totalDrain));
}
use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.
the class ToolHelper method createToolName.
public static String createToolName(Item item, List<ItemStack> materials) {
ToolPart part;
LocalizationHelper loc = SilentGems.localizationHelper;
Set<String> prefixSet = Sets.newLinkedHashSet();
Set<String> materialSet = Sets.newLinkedHashSet();
for (ItemStack stack : materials) {
part = ToolPartRegistry.fromStack(stack);
if (part != null) {
String prefix = part.getDisplayNamePrefix(stack);
if (prefix != null && !prefix.isEmpty())
prefixSet.add(prefix);
materialSet.add(part.getDisplayName(stack));
}
}
String prefix = String.join(" ", prefixSet);
if (!prefix.isEmpty())
prefix += " ";
String delimiter = loc.getLocalizedString("tool.silentgems:delimiter");
String materialName = String.join(delimiter, materialSet);
String toolName = ((IRegistryObject) item).getName();
String name = loc.getLocalizedString("tool", toolName, materialName);
return prefix + name;
}
use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.
the class ItemTipUpgrade method clAddInformation.
@Override
public void clAddInformation(ItemStack stack, World world, List list, boolean advanced) {
ToolPartTip part = (ToolPartTip) ToolPartRegistry.fromStack(stack);
if (part != null) {
LocalizationHelper loc = SilentGems.instance.localizationHelper;
String line;
list.add(loc.getItemSubText(itemName, "willReplace"));
list.add(loc.getItemSubText(itemName, "harvestLevel", part.getHarvestLevel()));
tooltipLine(loc, list, "durability", part.getDurability());
tooltipLine(loc, list, "harvestSpeed", part.getHarvestSpeed());
// tooltipLine(loc, list, "attackSpeed", part.getMeleeSpeed());
tooltipLine(loc, list, "meleeDamage", part.getMeleeDamage());
tooltipLine(loc, list, "magicDamage", part.getMagicDamage());
}
}
use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.
the class ItemGemArmor method clAddInformation.
@Override
public void clAddInformation(ItemStack stack, World world, List<String> list, boolean advanced) {
LocalizationHelper loc = SilentGems.localizationHelper;
ToolRenderHelper helper = ToolRenderHelper.getInstance();
boolean controlDown = KeyTracker.isControlDown();
boolean shiftDown = KeyTracker.isShiftDown();
boolean altDown = KeyTracker.isAltDown();
String line;
// UUID
if (GemsConfig.DEBUG_MODE && controlDown && shiftDown) {
UUID uuid = ToolHelper.hasUUID(stack) ? ToolHelper.getUUID(stack) : null;
list.add(uuid == null ? "No UUID" : uuid.toString());
uuid = ToolHelper.getSoulUUID(stack);
list.add(uuid == null ? "No Soul UUID" : uuid.toString());
}
// Tool Soul
ToolSoul soul = SoulManager.getSoul(stack);
if (soul != null) {
soul.addInformation(stack, world, list, advanced);
}
// Show original owner?
if (controlDown) {
String owner = ArmorHelper.getOriginalOwner(stack);
if (!owner.isEmpty()) {
list.add(loc.getMiscText("Tooltip.OriginalOwner", owner));
} else {
list.add(loc.getMiscText("Tooltip.OriginalOwner.Unknown"));
}
}
// TODO: Remove me
if (altDown) {
list.add(TextFormatting.RED + "Armor models WIP.");
}
// Broken?
if (ArmorHelper.isBroken(stack)) {
list.add(loc.getMiscText("Tooltip.Broken"));
}
final String sep = loc.getMiscText("Tooltip.Separator");
if (controlDown) {
// Properties header
list.add(loc.getMiscText("Tooltip.Properties"));
TextFormatting color = TextFormatting.YELLOW;
float durabilityBoost = ToolSoul.getDurabilityModifierForDisplay(soul);
list.add(color + helper.getTooltipLine("Durability", getMaxDamage(stack), durabilityBoost));
float protectionBoost = ToolSoul.getProtectionModifierForDisplay(soul);
list.add(color + helper.getTooltipLine("Protection", getProtection(stack), protectionBoost));
// Statistics Header
list.add(sep);
list.add(loc.getMiscText("Tooltip.Statistics"));
list.add(helper.getTooltipLine("DamageTaken", ArmorHelper.getStatDamageTaken(stack), 0f));
list.add(helper.getTooltipLine("Redecorated", ArmorHelper.getStatRedecorated(stack), 0f));
list.add(sep);
} else {
list.add(TextFormatting.GOLD + loc.getMiscText("PressCtrl"));
}
if (altDown) {
list.add(loc.getMiscText("Tooltip.Construction"));
ToolPart[] parts = ArmorHelper.getConstructionParts(stack);
EnumMaterialGrade[] grades = ArmorHelper.getConstructionGrades(stack);
for (int i = 0; i < parts.length; ++i) {
ToolPart part = parts[i];
EnumMaterialGrade grade = grades[i];
line = " " + TextFormatting.YELLOW + part.getKey() + TextFormatting.GOLD + " (" + grade + ")";
list.add(line);
}
ToolPart partFrame = ArmorHelper.getPart(stack, ArmorPartPosition.FRAME);
if (partFrame != null)
list.add(" " + TextFormatting.YELLOW + partFrame.getKey());
list.add(sep);
} else {
list.add(TextFormatting.GOLD + loc.getMiscText("PressAlt"));
}
}
use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.
the class ToolSoul method addInformation.
public void addInformation(ItemStack stack, World world, List<String> list, boolean advanced) {
LocalizationHelper loc = SilentGems.localizationHelper;
String color;
// Level, XP, AP
color = "" + TextFormatting.GREEN;
list.add(color + loc.getMiscText("ToolSoul.level", level, xp, getXpToNextLevel()));
list.add(color + loc.getMiscText("ToolSoul.actionPoints", actionPoints, getMaxActionPoints()));
boolean skillsKeyDown = Keyboard.isKeyDown(Keyboard.KEY_S);
if (skillsKeyDown || stack.getItem() instanceof ItemToolSoul) {
// Display elements.
String e1 = element1 == null ? "None" : element1.getDisplayName();
String e2 = element2 == null ? "None" : element2.getDisplayName();
String elements = e1 + (e2.equalsIgnoreCase("none") ? "" : ", " + e2);
list.add(loc.getMiscText("ToolSoul.elements", elements));
}
if (skillsKeyDown) {
// Display stat modifiers.
color = " " + TextFormatting.YELLOW;
float durability = getDurabilityModifierForDisplay(this);
float harvestSpeed = getHarvestSpeedModifierForDisplay(this);
float meleeDamage = getMeleeDamageModifierForDisplay(this);
float magicDamage = getMagicDamageModifierForDisplay(this);
float protection = getProtectionModifierForDisplay(this);
if (durability != 0f)
list.add(color + TooltipHelper.getAsColoredPercentage("Durability", durability, 0, true));
if (harvestSpeed != 0f)
list.add(color + TooltipHelper.getAsColoredPercentage("HarvestSpeed", harvestSpeed, 0, true));
if (meleeDamage != 0f)
list.add(color + TooltipHelper.getAsColoredPercentage("MeleeDamage", meleeDamage, 0, true));
if (magicDamage != 0f)
list.add(color + TooltipHelper.getAsColoredPercentage("MagicDamage", magicDamage, 0, true));
if (protection != 0f)
list.add(color + TooltipHelper.getAsColoredPercentage("Protection", protection, 0, true));
// Display skills.
for (Entry<SoulSkill, Integer> entry : skills.entrySet()) {
SoulSkill skill = entry.getKey();
int level = entry.getValue();
list.add(" " + skill.getLocalizedName(stack, level));
}
} else {
list.add(TextFormatting.GOLD + loc.getMiscText("Tooltip.keyForSkills"));
}
}
Aggregations