mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-22 21:19:46 +00:00
Added Subtitle support for entries, also, I'm a tease ;)
This commit is contained in:
1 parent
28216bce4d
commit
30025608b5
7 files changed
+101
-3
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. 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 <b>unlocalized</b> subtitle to show below the title. Here you'd
|
||||
* return something like "(This Entry is provided by the Botanic Tinkerer addon)".
|
||||
*/
|
||||
public String getSubtitle();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. 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";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
@@ -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.<br>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.<br>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
|
||||
|
||||
Reference in new issue
Block a user