From 11efe56437ef2ae4c1c79b7b0b901fe4242a4eb2 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 23:38:25 +0000 Subject: [PATCH] Replace old hardcoded spell book text with translation keys, fixes #368 --- .../wizardry/client/gui/GuiSpellBook.java | 23 ++++++++----------- .../assets/ebwizardry/lang/en_gb.lang | 9 +++++++- .../assets/ebwizardry/lang/en_us.lang | 7 ++++++ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java index 7fc6f7a1..2a4e3429 100644 --- a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java +++ b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java @@ -13,6 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import org.lwjgl.input.Keyboard; @@ -67,22 +68,18 @@ public class GuiSpellBook extends GuiScreen { 0x777777); } - //this.fontRenderer.drawString("-------------------", xPos + 17, yPos + 35, 0); + // Novice is usually white but this doesn't show up + String tier = I18n.format("gui.ebwizardry:spell_book.tier", spell.getTier() == Tier.NOVICE ? + "\u00A77" + spell.getTier().getDisplayName() : spell.getTier().getDisplayNameWithFormatting()); + this.fontRenderer.drawString(tier, xPos + 17, yPos + 45, 0); - if(spell.getTier() == Tier.NOVICE){ - // Novice is usually white but this doesn't show up. - this.fontRenderer.drawString("Tier: \u00A77" + Tier.NOVICE.getDisplayName(), xPos + 17, yPos + 45, 0); - }else{ - this.fontRenderer.drawString("Tier: " + spell.getTier().getDisplayNameWithFormatting(), xPos + 17, yPos + 45, 0); - } - - String element = "Element: " + spell.getElement().getFormattingCode() + spell.getElement().getDisplayName(); - if(!discovered) element = "Element: ?"; + String element = I18n.format("gui.ebwizardry:spell_book.tier", spell.getElement().getFormattingCode() + spell.getElement().getDisplayName()); + if(!discovered) element = I18n.format("gui.ebwizardry:spell_book.tier_undiscovered"); this.fontRenderer.drawString(element, xPos + 17, yPos + 57, 0); - String manaCost = "Mana Cost: " + spell.getCost(); - if(spell.isContinuous) manaCost = "Mana Cost: " + spell.getCost() + "/second"; - if(!discovered) manaCost = "Mana Cost: ?"; + String manaCost = I18n.format("gui.ebwizardry:spell_book.mana_cost", spell.getCost()); + if(spell.isContinuous) manaCost = I18n.format("gui.ebwizardry:spell_book.mana_cost_continuous", spell.getCost()); + if(!discovered) manaCost = I18n.format("gui.ebwizardry:spell_book.mana_cost_undiscovered"); this.fontRenderer.drawString(manaCost, xPos + 17, yPos + 69, 0); if(discovered){ diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index db9e697e..bf38dfc9 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -1,4 +1,4 @@ -#PARSE_ESCAPES +# PARSE_ESCAPES tile.ebwizardry\:arcane_workbench.name=Arcane Workbench tile.ebwizardry\:crystal_ore.name=Crystal Ore tile.ebwizardry\:petrified_stone.name=Petrified Stone @@ -498,6 +498,13 @@ advancement.ebwizardry\:enchant_scroll.desc=Craft a blank scroll and enchant it handbook.toast.title=New Handbook Section Unlocked! +gui.ebwizardry\:spell_book.tier=Tier: %s +gui.ebwizardry\:spell_book.element=Element: %s +gui.ebwizardry\:spell_book.element_undiscovered=Element: ? +gui.ebwizardry\:spell_book.mana_cost=Mana Cost: %s +gui.ebwizardry\:spell_book.mana_cost_continuous=Mana Cost: %s/second +gui.ebwizardry\:spell_book.mana_cost_undiscovered=Mana Cost: ? + container.ebwizardry\:arcane_workbench=Arcane Workbench container.ebwizardry\:arcane_workbench.apply=Apply container.ebwizardry\:arcane_workbench.mana=Mana\: diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index ca3d7a34..0a7269e9 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -498,6 +498,13 @@ advancement.ebwizardry\:enchant_scroll.desc=Craft a blank scroll and enchant it handbook.toast.title=New Handbook Section Unlocked! +gui.ebwizardry\:spell_book.tier=Tier: %s +gui.ebwizardry\:spell_book.element=Element: %s +gui.ebwizardry\:spell_book.element_undiscovered=Element: ? +gui.ebwizardry\:spell_book.mana_cost=Mana Cost: %s +gui.ebwizardry\:spell_book.mana_cost_continuous=Mana Cost: %s/second +gui.ebwizardry\:spell_book.mana_cost_undiscovered=Mana Cost: ? + container.ebwizardry\:arcane_workbench=Arcane Workbench container.ebwizardry\:arcane_workbench.apply=Apply container.ebwizardry\:arcane_workbench.mana=Mana\: