From 30025608b507d8f4bb1e08e6e9efe84c795896d4 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Sun, 8 Jun 2014 19:25:24 +0100 Subject: [PATCH] Added Subtitle support for entries, also, I'm a tease ;) --- .../botania/api/lexicon/IAddonEntry.java | 29 +++++++++++++++++++ .../vazkii/botania/client/gui/GuiLexicon.java | 18 ++++++++++-- .../botania/client/gui/GuiLexiconEntry.java | 12 +++++++- .../botania/common/lexicon/LexiconData.java | 8 +++++ .../common/lexicon/WIPLexiconEntry.java | 28 ++++++++++++++++++ .../vazkii/botania/common/lib/LibLexicon.java | 3 ++ resources/assets/botania/lang/en_US.lang | 6 ++++ 7 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 MODSRC/vazkii/botania/api/lexicon/IAddonEntry.java create mode 100644 MODSRC/vazkii/botania/common/lexicon/WIPLexiconEntry.java diff --git a/MODSRC/vazkii/botania/api/lexicon/IAddonEntry.java b/MODSRC/vazkii/botania/api/lexicon/IAddonEntry.java new file mode 100644 index 000000000..3e4e07668 --- /dev/null +++ b/MODSRC/vazkii/botania/api/lexicon/IAddonEntry.java @@ -0,0 +1,29 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jun 8, 2014, 7:02:48 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +/** + * Have a LexiconEntry implement this to signify it's an "Addon entry", as + * in, one provided by an Addon. This allows it to draw a subtitle of + * sorts, to prevent the [Mod tag here] nonsense that happened with thaumcraft + * addons. It can also be used for other purposes, such as stating an + * entry is WIP. + */ +public interface IAddonEntry { + + /** + * Returns the unlocalized subtitle to show below the title. Here you'd + * return something like "(This Entry is provided by the Botanic Tinkerer addon)". + */ + public String getSubtitle(); + +} diff --git a/MODSRC/vazkii/botania/client/gui/GuiLexicon.java b/MODSRC/vazkii/botania/client/gui/GuiLexicon.java index 27169eb71..1f3e8309e 100644 --- a/MODSRC/vazkii/botania/client/gui/GuiLexicon.java +++ b/MODSRC/vazkii/botania/client/gui/GuiLexicon.java @@ -61,8 +61,14 @@ public class GuiLexicon extends GuiScreen { GL11.glColor4f(1F, 1F, 1F, 1F); mc.renderEngine.bindTexture(texture); drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight); - drawCenteredString(fontRendererObj, getTitle(), left + guiWidth / 2, top - 12, 0x00FF00); - + drawCenteredString(fontRendererObj, getTitle(), left + guiWidth / 2, top - getTitleHeight(), 0x00FF00); + String subtitle = getSubtitle(); + if(subtitle != null) { + GL11.glScalef(0.5F, 0.5F, 1F); + drawCenteredString(fontRendererObj, subtitle, left * 2 + guiWidth, (top - getTitleHeight() + 10) * 2, 0x00FF00); + GL11.glScalef(2F, 2F, 1F); + } + drawHeader(); super.drawScreen(par1, par2, par3); @@ -98,7 +104,15 @@ public class GuiLexicon extends GuiScreen { String getTitle() { return ModItems.lexicon.getItemStackDisplayName(null); } + + String getSubtitle() { + return null; + } + int getTitleHeight() { + return getSubtitle() == null ? 12 : 16; + } + boolean isIndex() { return true; } diff --git a/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java b/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java index 27f3a4047..0c074f1f9 100644 --- a/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java +++ b/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java @@ -15,6 +15,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.StatCollector; import vazkii.botania.api.internal.IGuiLexiconEntry; +import vazkii.botania.api.lexicon.IAddonEntry; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconPage; import vazkii.botania.client.core.handler.ClientTickHandler; @@ -27,6 +28,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry { LexiconEntry entry; GuiScreen parent; String title; + String subtitle; GuiButton leftButton, rightButton; @@ -35,6 +37,9 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry { this.parent = parent; title = StatCollector.translateToLocal(entry.getUnlocalizedName()); + if(entry instanceof IAddonEntry) + subtitle = StatCollector.translateToLocal(((IAddonEntry) entry).getSubtitle()); + else subtitle = null; } @Override @@ -72,7 +77,12 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry { String getTitle() { return String.format("%s (%s/%s)", title, page + 1, entry.pages.size()); } - + + @Override + String getSubtitle() { + return subtitle; + } + @Override protected void actionPerformed(GuiButton par1GuiButton) { switch(par1GuiButton.id) { diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index 8840d6e71..a4da7e6c0 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -41,6 +41,7 @@ public final class LexiconData { public static LexiconCategory categoryDevices; public static LexiconCategory categoryTools; public static LexiconCategory categoryBaubles; + public static LexiconCategory categoryAlfhomancy; public static LexiconCategory categoryMisc; public static LexiconEntry flowers; @@ -138,6 +139,8 @@ public final class LexiconData { public static LexiconEntry divaCharm; public static LexiconEntry flightTiara; + public static LexiconEntry alfhomancyIntro; + public static LexiconEntry unstableBlocks; public static LexiconEntry decorativeBlocks; public static LexiconEntry dispenserTweaks; @@ -151,6 +154,7 @@ public final class LexiconData { BotaniaAPI.addCategory(categoryDevices = new LexiconCategory(LibLexicon.CATEGORY_DEVICES)); BotaniaAPI.addCategory(categoryTools = new LexiconCategory(LibLexicon.CATEGORY_TOOLS)); BotaniaAPI.addCategory(categoryBaubles = new LexiconCategory(LibLexicon.CATEGORY_BAUBLES)); + BotaniaAPI.addCategory(categoryAlfhomancy = new LexiconCategory(LibLexicon.CATEGORY_ALFHOMANCY)); BotaniaAPI.addCategory(categoryMisc = new LexiconCategory(LibLexicon.CATEGORY_MISC)); // BASICS ENTRIES @@ -439,6 +443,10 @@ public final class LexiconData { flightTiara = new BLexiconEntry(LibLexicon.BAUBLE_FLIGHT_TIARA, categoryBaubles); flightTiara.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeFlightTiara)); + // ALFHOMANCY ENTRIES + alfhomancyIntro = new WIPLexiconEntry(LibLexicon.ALF_INTRO, categoryAlfhomancy); + alfhomancyIntro.setLexiconPages(new PageText("0")); + // MISCLENAEOUS ENTRIES unstableBlocks = new BLexiconEntry(LibLexicon.MISC_UNSTABLE_BLOCKS, categoryMisc); unstableBlocks.setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_UNSTABLE_BLOCK), new PageCraftingRecipe("2", ModCrafingRecipes.recipesUnstableBlocks), new PageText("3"), new PageImage("4", LibResources.ENTRY_UNSTABLE_BEACON), new PageCraftingRecipe("5", ModCrafingRecipes.recipesManaBeacons), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipesSignalFlares)); diff --git a/MODSRC/vazkii/botania/common/lexicon/WIPLexiconEntry.java b/MODSRC/vazkii/botania/common/lexicon/WIPLexiconEntry.java new file mode 100644 index 000000000..7ff43e82b --- /dev/null +++ b/MODSRC/vazkii/botania/common/lexicon/WIPLexiconEntry.java @@ -0,0 +1,28 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jun 8, 2014, 7:06:06 PM (GMT)] + */ +package vazkii.botania.common.lexicon; + +import vazkii.botania.api.lexicon.IAddonEntry; +import vazkii.botania.api.lexicon.LexiconCategory; + +public class WIPLexiconEntry extends BLexiconEntry implements IAddonEntry { + + public WIPLexiconEntry(String unlocalizedName, LexiconCategory category) { + super(unlocalizedName, category); + } + + @Override + public String getSubtitle() { + return "botania.gui.lexicon.wip"; + } + +} diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index df0fd6ec2..5be880276 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -22,6 +22,7 @@ public final class LibLexicon { public static final String CATEGORY_DEVICES = CATEGORY_PREFIX + "devices"; public static final String CATEGORY_TOOLS = CATEGORY_PREFIX + "tools"; public static final String CATEGORY_BAUBLES = CATEGORY_PREFIX + "baubles"; + public static final String CATEGORY_ALFHOMANCY = CATEGORY_PREFIX + "alfhomancy"; public static final String CATEGORY_MISC = CATEGORY_PREFIX + "misc"; public static final String BASICS_FLOWERS = "flowers"; @@ -119,6 +120,8 @@ public final class LibLexicon { public static final String BAUBLE_DIVA_CHARM = "divaCharm"; public static final String BAUBLE_FLIGHT_TIARA = "flightTiara"; + public static final String ALF_INTRO = "aIntro"; + public static final String MISC_UNSTABLE_BLOCKS = "unstableBlocks"; public static final String MISC_DECORATIVE_BLOCKS = "decorativeBlocks"; public static final String MISC_DISPENSER_TWEAKS = "dispenserTweaks"; diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 8df374b25..0e393a56f 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -394,6 +394,7 @@ item.botania:flightTiara.name=Flügel Tiara # GUI TEXT botania.gui.lexicon.header=Lexica Botania Index - Pick which category you would like to study: +botania.gui.lexicon.wip=(This entry is a Work In Progress. It's not even it's final form) # LEXICON CATEGORIES botania.category.basics=Basics @@ -403,6 +404,7 @@ botania.category.generationFlowers=Generating Flora botania.category.devices=Natural Apparatus botania.category.tools=Mystical Instruments botania.category.baubles=Baubles and Acessories +botania.category.alfhomancy=Alfhomancy botania.category.misc=Miscellaneous # LEXICON ENTRIES @@ -968,6 +970,10 @@ botania.entry.flightTiara=Flügel Tiara botania.page.flightTiara0=The &4Flügel&0 were once a dominant species in the lands, now they're but a race past extinct, once created as godslayers, who possessed the ability of flight.
The usage of &1Essence of Eternal Life&0 allows for a small replica of their power, in the form of the &1Flügel Tiara&0, which, at the cost of &4Mana&0 allows for flight. botania.page.flightTiara1=Forty thousand books from another world +# -- ALFHOMANCY +botania.entry.aIntro=The Portal to Alfheim +botania.page.aIntro0=Once, in olden times, &4Elves&0 used to share the world with us &4Minecrafters&0. Due to unknown events, they have been banished back to their own world, &4Alfheim&0.
Experimentation has been done in atempt to bridge the gap between the two worlds but not much has been found thus far. + # - MISCLANEOUS # -- UNSTABLE CUBE botania.entry.unstableBlocks=Unstable Cubes