New fancy lexicon main page.
No files matched your search
@@ -14,11 +14,14 @@ package vazkii.botania.api.lexicon;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class LexiconCategory {
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class LexiconCategory {
|
||||
|
||||
public final String unlocalizedName;
|
||||
public final List<LexiconEntry> entries = new ArrayList<LexiconEntry>();
|
||||
|
||||
private ResourceLocation icon;
|
||||
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this category. This will be localized by the client display.
|
||||
*/
|
||||
@@ -29,4 +32,13 @@ public final class LexiconCategory {
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
public LexiconCategory setIcon(ResourceLocation icon) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResourceLocation getIcon() {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@API(owner = "Botania", apiVersion = "18", provides = "BotaniaAPI")
|
||||
@API(owner = "Botania", apiVersion = "19", provides = "BotaniaAPI")
|
||||
package vazkii.botania.api;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -31,6 +31,7 @@ import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonBookmark;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonCategory;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
@@ -47,6 +48,9 @@ public class GuiLexicon extends GuiScreen {
|
||||
public static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_LEXICON);
|
||||
public static final ResourceLocation textureToff = new ResourceLocation(LibResources.GUI_TOFF);
|
||||
|
||||
public float lastTime = 0F;
|
||||
public float timeDelta = 0F;
|
||||
|
||||
String title;
|
||||
int guiWidth = 146;
|
||||
int guiHeight = 180;
|
||||
@@ -55,7 +59,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
lastTime = ClientTickHandler.ticksInGame;
|
||||
|
||||
title = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getDisplayName();
|
||||
currentOpenLexicon = this;
|
||||
|
||||
@@ -70,12 +75,28 @@ public class GuiLexicon extends GuiScreen {
|
||||
buttonList.add(new GuiButtonInvisible(i, left + x, top + y, 110, 10, ""));
|
||||
}
|
||||
populateIndex();
|
||||
} else if(isCategoryIndex()) {
|
||||
int categories = BotaniaAPI.getAllCategories().size();
|
||||
for(int i = 0; i < categories + 1; i++) {
|
||||
LexiconCategory category = null;
|
||||
category = i >= categories ? null : BotaniaAPI.getAllCategories().get(i);
|
||||
int x = i % 4;
|
||||
int y = i / 4;
|
||||
|
||||
int size = 27;
|
||||
GuiButtonCategory button = new GuiButtonCategory(i, left + 18 + x * size, top + 35 + y * size, this, category);
|
||||
buttonList.add(button);
|
||||
}
|
||||
}
|
||||
populateBookmarks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
float time = ClientTickHandler.ticksInGame + par3;
|
||||
timeDelta = time - lastTime;
|
||||
lastTime = time;
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight);
|
||||
@@ -140,7 +161,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
void drawHeader() {
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
fontRendererObj.drawSplitString(String.format(StatCollector.translateToLocal("botania.gui.lexicon.header"), ItemLexicon.getEdition()), left + 18, top + 14, 110, 0);
|
||||
fontRendererObj.drawSplitString(String.format(StatCollector.translateToLocal("botania.gui.lexicon.header"), ItemLexicon.getEdition()), left + 18, top + 12, 110, 0);
|
||||
fontRendererObj.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
@@ -148,13 +169,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
handleBookmark(par1GuiButton);
|
||||
else {
|
||||
int i = par1GuiButton.id - 2;
|
||||
if(i < 0)
|
||||
return;
|
||||
|
||||
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
|
||||
LexiconCategory category = i >= categoryList.size() ? null : categoryList.get(i);
|
||||
else if(par1GuiButton instanceof GuiButtonCategory) {
|
||||
LexiconCategory category = ((GuiButtonCategory) par1GuiButton).getCategory();
|
||||
|
||||
mc.displayGuiScreen(new GuiLexiconIndex(category));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
@@ -209,9 +225,13 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
boolean isIndex() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isCategoryIndex() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void populateIndex() {
|
||||
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
|
||||
int shift = 2;
|
||||
|
||||
@@ -70,11 +70,6 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isIndex() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
void drawHeader() {
|
||||
// NO-OP
|
||||
@@ -89,6 +84,11 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
String getSubtitle() {
|
||||
return subtitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isCategoryIndex() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
|
||||
@@ -60,6 +60,16 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isIndex() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isCategoryIndex() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
@@ -11,10 +11,11 @@ import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui = new GuiLexicon();
|
||||
GuiLexicon gui;
|
||||
|
||||
public GuiButtonBookmark(int par1, int par2, int par3, GuiLexicon gui, String str) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 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 @ [Oct 18, 2014, 4:00:30 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import scala.actors.threadpool.Arrays;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
|
||||
public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
|
||||
private static final ResourceLocation fallbackResource = new ResourceLocation(LibResources.CATEGORY_INDEX);
|
||||
|
||||
GuiLexicon gui;
|
||||
LexiconCategory category;
|
||||
float ticksHovered = 0F;
|
||||
|
||||
public GuiButtonCategory(int id, int x, int y, GuiLexicon gui, LexiconCategory category) {
|
||||
super(id, x, y, 24, 24, "");
|
||||
this.gui = gui;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mx, int my) {
|
||||
boolean inside = mx >= xPosition && my >= yPosition && mx < xPosition + width && my < yPosition + height;
|
||||
float time = 5F;
|
||||
if(inside)
|
||||
ticksHovered = Math.min(time, ticksHovered + gui.timeDelta);
|
||||
else ticksHovered = Math.max(0F, ticksHovered - gui.timeDelta);
|
||||
|
||||
ResourceLocation resource;
|
||||
if(category == null)
|
||||
resource = fallbackResource;
|
||||
else resource = category.getIcon();
|
||||
if(resource == null)
|
||||
resource = fallbackResource;
|
||||
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
float s = 1F / 48F;
|
||||
float defAlpha = 0.3F;
|
||||
float alpha = (ticksHovered / time) * (1F - defAlpha) + defAlpha;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, alpha);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
RenderHelper.drawTexturedModalRect(xPosition * 2, yPosition * 2, zLevel * 2, 0, 0, 48, 48, s, s);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(inside)
|
||||
RenderHelper.renderTooltipGreen(mx, my, Arrays.asList(new String[] {StatCollector.translateToLocal(getTooltipText())}));
|
||||
}
|
||||
|
||||
String getTooltipText() {
|
||||
if(category == null)
|
||||
return "botaniamisc.lexiconIndex";
|
||||
return category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
public LexiconCategory getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public final class LibResources {
|
||||
public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/";
|
||||
public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/";
|
||||
public static final String PREFIX_OBJ_MODEL = PREFIX_MOD + "model/";
|
||||
public static final String PREFIX_CATEGORIES = PREFIX_GUI + "categories/";
|
||||
|
||||
public static final String EMTPY_TEXTURE = "emptyTexture";
|
||||
|
||||
@@ -98,6 +99,8 @@ public final class LibResources {
|
||||
|
||||
public static final String OBJ_MODEL_PYLON = PREFIX_OBJ_MODEL + "pylon.obj";
|
||||
|
||||
public static final String CATEGORY_INDEX = PREFIX_CATEGORIES + "index.png";
|
||||
|
||||
public static final String SHADER_PYLON_GLOW_FRAG = PREFIX_SHADER + "pylon_glow.frag";
|
||||
public static final String SHADER_ENCHANTER_RUNE_FRAG = PREFIX_SHADER + "enchanter_rune.frag";
|
||||
public static final String SHADER_MANA_POOL_FRAG = PREFIX_SHADER + "mana_pool.frag";
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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 @ [Oct 18, 2014, 3:46:10 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.lexicon;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.lib.LibLexicon;
|
||||
|
||||
public class BLexiconCategory extends LexiconCategory {
|
||||
|
||||
public BLexiconCategory(String unlocalizedName) {
|
||||
super(LibLexicon.CATEGORY_PREFIX + unlocalizedName);
|
||||
setIcon(new ResourceLocation(LibResources.PREFIX_CATEGORIES + unlocalizedName + ".png"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -191,15 +191,15 @@ public final class LexiconData {
|
||||
public static LexiconEntry tcIntegration;
|
||||
|
||||
public static void init() {
|
||||
BotaniaAPI.addCategory(categoryBasics = new LexiconCategory(LibLexicon.CATEGORY_BASICS));
|
||||
BotaniaAPI.addCategory(categoryMana = new LexiconCategory(LibLexicon.CATEGORY_MANA));
|
||||
BotaniaAPI.addCategory(categoryGenerationFlowers = new LexiconCategory(LibLexicon.CATEGORY_GENERATION_FLOWERS));
|
||||
BotaniaAPI.addCategory(categoryFunctionalFlowers = new LexiconCategory(LibLexicon.CATEGORY_FUNCTIONAL_FLOWERS));
|
||||
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));
|
||||
BotaniaAPI.addCategory(categoryBasics = new BLexiconCategory(LibLexicon.CATEGORY_BASICS));
|
||||
BotaniaAPI.addCategory(categoryMana = new BLexiconCategory(LibLexicon.CATEGORY_MANA));
|
||||
BotaniaAPI.addCategory(categoryGenerationFlowers = new BLexiconCategory(LibLexicon.CATEGORY_GENERATION_FLOWERS));
|
||||
BotaniaAPI.addCategory(categoryFunctionalFlowers = new BLexiconCategory(LibLexicon.CATEGORY_FUNCTIONAL_FLOWERS));
|
||||
BotaniaAPI.addCategory(categoryDevices = new BLexiconCategory(LibLexicon.CATEGORY_DEVICES));
|
||||
BotaniaAPI.addCategory(categoryTools = new BLexiconCategory(LibLexicon.CATEGORY_TOOLS));
|
||||
BotaniaAPI.addCategory(categoryBaubles = new BLexiconCategory(LibLexicon.CATEGORY_BAUBLES));
|
||||
BotaniaAPI.addCategory(categoryAlfhomancy = new BLexiconCategory(LibLexicon.CATEGORY_ALFHOMANCY));
|
||||
BotaniaAPI.addCategory(categoryMisc = new BLexiconCategory(LibLexicon.CATEGORY_MISC));
|
||||
|
||||
// BASICS ENTRIES
|
||||
introVideo = new BLexiconEntry(LibLexicon.BASICS_INTRO_VIDEO, categoryBasics);
|
||||
|
||||
@@ -15,15 +15,15 @@ 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_MANA = CATEGORY_PREFIX + "mana";
|
||||
public static final String CATEGORY_FUNCTIONAL_FLOWERS = CATEGORY_PREFIX + "functionalFlowers";
|
||||
public static final String CATEGORY_GENERATION_FLOWERS = CATEGORY_PREFIX + "generationFlowers";
|
||||
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 CATEGORY_BASICS = "basics";
|
||||
public static final String CATEGORY_MANA = "mana";
|
||||
public static final String CATEGORY_FUNCTIONAL_FLOWERS = "functionalFlowers";
|
||||
public static final String CATEGORY_GENERATION_FLOWERS = "generationFlowers";
|
||||
public static final String CATEGORY_DEVICES = "devices";
|
||||
public static final String CATEGORY_TOOLS = "tools";
|
||||
public static final String CATEGORY_BAUBLES = "baubles";
|
||||
public static final String CATEGORY_ALFHOMANCY = "alfhomancy";
|
||||
public static final String CATEGORY_MISC = "misc";
|
||||
|
||||
public static final String BASICS_INTRO_VIDEO = "introVideo";
|
||||
public static final String BASICS_FLOWERS = "flowers";
|
||||
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.2 KiB |