Change tome of arcana description to be more accurate, closes #330. Also adds format args support to multi-line item descriptions and fixes the 1st argument being used instead of the 2nd in the lang files.

This commit is contained in:
Electroblob77
2020-01-28 18:36:34 +00:00
parent 311b5750df
commit f13f220564
5 changed files with 12 additions and 15 deletions
@@ -100,9 +100,9 @@ public class CommonProxy {
return ((ItemSpectralBow)WizardryItems.spectral_bow).getDefaultDurabilityForDisplay(stack); return ((ItemSpectralBow)WizardryItems.spectral_bow).getDefaultDurabilityForDisplay(stack);
} }
/** Like {@link CommonProxy#addMultiLineDescription(List, String, Style)}, but style defaults to light grey. */ /** Like {@link CommonProxy#addMultiLineDescription(List, String, Style, Object...)}, but style defaults to light grey. */
public void addMultiLineDescription(List<String> tooltip, String key){ public void addMultiLineDescription(List<String> tooltip, String key, Object... args){
this.addMultiLineDescription(tooltip, key, new Style().setColor(TextFormatting.GRAY)); this.addMultiLineDescription(tooltip, key, new Style().setColor(TextFormatting.GRAY), args);
} }
/** /**
@@ -113,7 +113,7 @@ public class CommonProxy {
* @param key The translation key for the description * @param key The translation key for the description
* @param style A style to apply * @param style A style to apply
*/ */
public void addMultiLineDescription(List<String> tooltip, String key, Style style){} public void addMultiLineDescription(List<String> tooltip, String key, Style style, Object... args){}
// SECTION Packet Handlers // SECTION Packet Handlers
// =============================================================================================================== // ===============================================================================================================
@@ -107,7 +107,7 @@ public class ClientProxy extends CommonProxy {
// Armour Model // Armour Model
public static final ModelBiped WIZARD_ARMOUR_MODEL = new ModelWizardArmour(0.75f); public static final ModelBiped WIZARD_ARMOUR_MODEL = new ModelWizardArmour(0.75f);
/** The wrap width for standard multi-line descriptions (see {@link ClientProxy#addMultiLineDescription(List, String, Style)}). */ /** The wrap width for standard multi-line descriptions (see {@link ClientProxy#addMultiLineDescription(List, String, Style, Object...)}). */
private static final int TOOLTIP_WRAP_WIDTH = 140; private static final int TOOLTIP_WRAP_WIDTH = 140;
// SECTION Registry // SECTION Registry
@@ -287,8 +287,8 @@ public class ClientProxy extends CommonProxy {
} }
@Override @Override
public void addMultiLineDescription(List<String> tooltip, String key, Style style){ public void addMultiLineDescription(List<String> tooltip, String key, Style style, Object... args){
String description = style.getFormattingCode() + I18n.format(key); String description = style.getFormattingCode() + I18n.format(key, args);
tooltip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(description, TOOLTIP_WRAP_WIDTH)); tooltip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(description, TOOLTIP_WRAP_WIDTH));
} }
@@ -61,11 +61,10 @@ public class ItemArcaneTome extends Item {
Tier tier = Tier.values()[stack.getItemDamage()]; Tier tier = Tier.values()[stack.getItemDamage()];
Tier tier2 = Tier.values()[stack.getItemDamage() - 1]; Tier tier2 = Tier.values()[stack.getItemDamage() - 1];
tooltip.add(tier.getDisplayNameWithFormatting()); tooltip.add(tier.getDisplayNameWithFormatting());
tooltip.add("\u00A77" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":arcane_tome.desc1", Wizardry.proxy.addMultiLineDescription(tooltip, "item." + this.getRegistryName() + ".desc",
tier2.getDisplayNameWithFormatting())); tier2.getDisplayNameWithFormatting() + "\u00A77", tier.getDisplayNameWithFormatting() + "\u00A77");
tooltip.add("\u00A77" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":arcane_tome.desc2",
tier.getDisplayNameWithFormatting() + "\u00A77"));
} }
} }
@@ -44,8 +44,7 @@ item.ebwizardry\:spell_book.name=Spell Book
item.ebwizardry\:spell_book.apply_to_wizard=Replaced %1$s's spell %2$s with %3$s item.ebwizardry\:spell_book.apply_to_wizard=Replaced %1$s's spell %2$s with %3$s
item.ebwizardry\:arcane_tome.name=Tome of Arcana item.ebwizardry\:arcane_tome.name=Tome of Arcana
item.ebwizardry\:arcane_tome.desc1=Upgrades any %1$s item.ebwizardry\:arcane_tome.desc=Upgrades any %1$s wand with sufficient progression to %2$s tier
item.ebwizardry\:arcane_tome.desc2=wand to %1$s tier
item.ebwizardry\:wizard_handbook.name=The Wizard's Handbook item.ebwizardry\:wizard_handbook.name=The Wizard's Handbook
item.ebwizardry\:wizard_handbook.desc=by %1$s item.ebwizardry\:wizard_handbook.desc=by %1$s
@@ -44,8 +44,7 @@ item.ebwizardry\:spell_book.name=Spell Book
item.ebwizardry\:spell_book.apply_to_wizard=Replaced %1$s's spell %2$s with %3$s item.ebwizardry\:spell_book.apply_to_wizard=Replaced %1$s's spell %2$s with %3$s
item.ebwizardry\:arcane_tome.name=Tome of Arcana item.ebwizardry\:arcane_tome.name=Tome of Arcana
item.ebwizardry\:arcane_tome.desc1=Upgrades any %1$s item.ebwizardry\:arcane_tome.desc=Upgrades any %1$s wand with sufficient progression to %2$s tier
item.ebwizardry\:arcane_tome.desc2=wand to %1$s tier
item.ebwizardry\:wizard_handbook.name=The Wizard's Handbook item.ebwizardry\:wizard_handbook.name=The Wizard's Handbook
item.ebwizardry\:wizard_handbook.desc=by %1$s item.ebwizardry\:wizard_handbook.desc=by %1$s