mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 11:49:37 +00:00
Some more GUI work. Nothing to show off yet.
This commit is contained in:
1 parent
28ebf31c61
commit
dff41f433c
3 files changed
+86
-8
No files matched your search
@@ -11,10 +11,19 @@
|
||||
*/
|
||||
package vazkii.botania.client.gui;
|
||||
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.LexiconCategory;
|
||||
import vazkii.botania.client.gui.button.GuiButtonInvisible;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class GuiLexicon extends GuiScreen {
|
||||
|
||||
@@ -27,17 +36,47 @@ public class GuiLexicon extends GuiScreen {
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
left = width / 2 - guiWidth / 2;
|
||||
top = height / 2 - guiHeight / 2;
|
||||
|
||||
if(isIndex()) {
|
||||
buttonList.clear();
|
||||
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"));
|
||||
}
|
||||
populateIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight);
|
||||
drawCenteredString(fontRenderer, ModItems.lexicon.getItemDisplayName(null), left + guiWidth / 2, top - 12, 0x00FF00);
|
||||
drawCenteredString(fontRenderer, getTitle(), left + guiWidth / 2, top - 12, 0x00FF00);
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
}
|
||||
|
||||
String getTitle() {
|
||||
return ModItems.lexicon.getItemDisplayName(null);
|
||||
}
|
||||
|
||||
boolean isIndex() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void populateIndex() {
|
||||
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
|
||||
for(int i = 0; i < 12; i++) {
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);
|
||||
LexiconCategory category = i >= categoryList.size() ? null : categoryList.get(i);
|
||||
if(category != null)
|
||||
button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName());
|
||||
else button.displayString = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,4 +13,9 @@ package vazkii.botania.client.gui;
|
||||
|
||||
public class GuiLexiconIndex extends GuiLexicon {
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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, 8:34:01 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
public class GuiButtonInvisible extends GuiButton {
|
||||
|
||||
public GuiButtonInvisible(int par1, int par2, int par3, int par4, int par5, String par6Str) {
|
||||
super(par1, par2, par3, par4, par5, par6Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_82253_i = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
int k = getHoverState(field_82253_i);
|
||||
|
||||
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.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user