mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-23 21:49:50 +00:00
A basic Index.
This commit is contained in:
1 parent
dff41f433c
commit
24eb3dbb1a
6 files changed
+82
-7
No files matched your search
@@ -44,7 +44,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
int x = 18;
|
||||
for(int i = 0; i < 12; i++) {
|
||||
int y = 16 + i * 12;
|
||||
buttonList.add(new GuiButtonInvisible(i, left + x, top + y, 110, 10, "lorem ipsum"));
|
||||
buttonList.add(new GuiButtonInvisible(i, left + x, top + y, 110, 10, ""));
|
||||
}
|
||||
populateIndex();
|
||||
}
|
||||
@@ -57,6 +57,11 @@ public class GuiLexicon extends GuiScreen {
|
||||
drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight);
|
||||
drawCenteredString(fontRenderer, getTitle(), left + guiWidth / 2, top - 12, 0x00FF00);
|
||||
|
||||
boolean unicode = fontRenderer.getUnicodeFlag();
|
||||
fontRenderer.setUnicodeFlag(true);
|
||||
fontRenderer.drawSplitString(StatCollector.translateToLocal("botania.gui.lexicon.header"), left + 15, top + 20, 110, 0);
|
||||
fontRenderer.setUnicodeFlag(unicode);
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
}
|
||||
|
||||
@@ -70,11 +75,12 @@ public class GuiLexicon extends GuiScreen {
|
||||
|
||||
void populateIndex() {
|
||||
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
|
||||
for(int i = 0; i < 12; i++) {
|
||||
for(int i = 3; i < 12; i++) {
|
||||
int i_ = i - 3;
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);
|
||||
LexiconCategory category = i >= categoryList.size() ? null : categoryList.get(i);
|
||||
LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_);
|
||||
if(category != null)
|
||||
button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName());
|
||||
button.displayString = " " + StatCollector.translateToLocal(category.getUnlocalizedName());
|
||||
else button.displayString = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.client.gui.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class GuiButtonInvisible extends GuiButton {
|
||||
|
||||
@@ -27,7 +28,7 @@ public class GuiButtonInvisible extends GuiButton {
|
||||
|
||||
boolean unicode = par1Minecraft.fontRenderer.getUnicodeFlag();
|
||||
par1Minecraft.fontRenderer.setUnicodeFlag(true);
|
||||
par1Minecraft.fontRenderer.drawString(displayString, xPosition + (k == 2 ? 5 : 0), yPosition + (height - 8) / 2, 0);
|
||||
par1Minecraft.fontRenderer.drawString((k == 2 ? EnumChatFormatting.BOLD : "") + displayString, xPosition/* + (k == 2 ? 5 : 0)*/, yPosition + (height - 8) / 2, 0);
|
||||
par1Minecraft.fontRenderer.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.handler.InternalMethodHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.network.GuiHandler;
|
||||
import vazkii.botania.common.page.LexiconData;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -32,9 +33,10 @@ public class CommonProxy {
|
||||
|
||||
ModBlocks.init();
|
||||
ModItems.init();
|
||||
LexiconData.init();
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
public void init(FMLInitializationEvent event) {
|
||||
NetworkRegistry.instance().registerGuiHandler(Botania.instance, new GuiHandler());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 @ [Jan 14, 2014, 9:14:08 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.lib;
|
||||
|
||||
public final class LibLexicon {
|
||||
|
||||
public static final String CATEGORY_PREFIX = "botania.category.";
|
||||
|
||||
public static final String CATEGORY_BASICS = CATEGORY_PREFIX + "basics";
|
||||
public static final String CATEGORY_ENERGY = CATEGORY_PREFIX + "energy";
|
||||
public static final String CATEGORY_PLANTS = CATEGORY_PREFIX + "plants";
|
||||
public static final String CATEGORY_MISC = CATEGORY_PREFIX + "misc";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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 @ [Jan 14, 2014, 9:12:15 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.page;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.LexiconCategory;
|
||||
import vazkii.botania.common.lib.LibLexicon;
|
||||
|
||||
public final class LexiconData {
|
||||
|
||||
public static LexiconCategory categoryBasics;
|
||||
public static LexiconCategory categoryEnergy;
|
||||
public static LexiconCategory categoryPlants;
|
||||
public static LexiconCategory categoryMisc;
|
||||
|
||||
public static void init() {
|
||||
BotaniaAPI.addCategory(categoryBasics = new LexiconCategory(LibLexicon.CATEGORY_BASICS));
|
||||
BotaniaAPI.addCategory(categoryEnergy = new LexiconCategory(LibLexicon.CATEGORY_ENERGY));
|
||||
BotaniaAPI.addCategory(categoryPlants = new LexiconCategory(LibLexicon.CATEGORY_PLANTS));
|
||||
BotaniaAPI.addCategory(categoryMisc = new LexiconCategory(LibLexicon.CATEGORY_MISC));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,4 +4,13 @@ itemGroup.Botania=Botania
|
||||
# BLOCK NAMES
|
||||
|
||||
# ITEM NAMES
|
||||
item.botania:lexicon.name=Lexica Botania
|
||||
item.botania:lexicon.name=Lexica Botania
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.lexicon.header=Lexica Botania Index - Pick which category you would like to study:
|
||||
|
||||
# LEXICON CATEGORIES
|
||||
botania.category.basics=Basics
|
||||
botania.category.energy=Energy and Mana
|
||||
botania.category.plants=Magical Plants
|
||||
botania.category.misc=Miscellaneous
|
||||
Reference in new issue
Block a user