diff --git a/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java b/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java index c354b1543..54e0b7182 100644 --- a/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java +++ b/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java @@ -21,6 +21,11 @@ public class DummyMethodHandler implements IInternalMethodHandler { return dummyPage(key); } + @Override + public LexiconPage imagePage(String key, String resource) { + return dummyPage(resource); + } + private LexiconPage dummyPage(String key) { return new PageDummy(key); } diff --git a/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java b/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java index 9f38f9bfc..37f5c563a 100644 --- a/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java +++ b/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java @@ -24,4 +24,6 @@ public interface IInternalMethodHandler { public LexiconPage textPage(String key); + public LexiconPage imagePage(String key, String resource); + } diff --git a/MODSRC/vazkii/botania/client/lib/LibResources.java b/MODSRC/vazkii/botania/client/lib/LibResources.java index f28ab38cd..31dc56de6 100644 --- a/MODSRC/vazkii/botania/client/lib/LibResources.java +++ b/MODSRC/vazkii/botania/client/lib/LibResources.java @@ -18,6 +18,7 @@ public final class LibResources { public static final String PREFIX_LANG = "/assets/botania/lang/"; public static final String PREFIX_GUI = PREFIX_MOD + "textures/gui/"; + public static final String PREFIX_ENTRIES = PREFIX_GUI + "entries/"; public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/"; public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/"; @@ -25,6 +26,8 @@ public final class LibResources { public static final String GUI_LEXICON = PREFIX_GUI + "lexicon.png"; + public static final String ENTRY_FLOWERS = PREFIX_ENTRIES + "flowers.png"; + public static final String[] LANGS = new String[] { "en_US" }; diff --git a/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java b/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java index 170e8793a..4af92ce7e 100644 --- a/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java @@ -13,6 +13,7 @@ package vazkii.botania.common.core.handler; import vazkii.botania.api.internal.IInternalMethodHandler; import vazkii.botania.api.page.LexiconPage; +import vazkii.botania.common.lexicon.page.PageImage; import vazkii.botania.common.lexicon.page.PageText; public class InternalMethodHandler implements IInternalMethodHandler { @@ -21,5 +22,10 @@ public class InternalMethodHandler implements IInternalMethodHandler { public LexiconPage textPage(String key) { return new PageText(key); } + + @Override + public LexiconPage imagePage(String key, String resource) { + return new PageImage(key, resource); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index bf1e30328..f7b9f8b07 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -14,6 +14,8 @@ package vazkii.botania.common.lexicon; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.LexiconCategory; import vazkii.botania.api.LexiconEntry; +import vazkii.botania.client.lib.LibResources; +import vazkii.botania.common.lexicon.page.PageImage; import vazkii.botania.common.lexicon.page.PageText; import vazkii.botania.common.lib.LibLexicon; @@ -38,10 +40,10 @@ public final class LexiconData { // BASICS ENTRIES entry = new BLexiconEntry("world", categoryBasics); - entry.setLexiconPages(new PageText("0"), new PageText("1")); + entry.setLexiconPages(new PageText("0"), new PageText("1"), new PageImage("2", LibResources.ENTRY_FLOWERS)); entry = new BLexiconEntry("basicConcepts", categoryBasics); - entry.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); + entry.setLexiconPages(new PageText("0"), new PageText("1")); entry = new BLexiconEntry("gettingStarted", categoryBasics); entry.setLexiconPages(new PageText("0")); diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageImage.java b/MODSRC/vazkii/botania/common/lexicon/page/PageImage.java new file mode 100644 index 000000000..a0e2ee3c0 --- /dev/null +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageImage.java @@ -0,0 +1,50 @@ +/** + * 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 @ [Jan 16, 2014, 6:13:08 PM (GMT)] + */ +package vazkii.botania.common.lexicon.page; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; +import vazkii.botania.api.internal.IGuiLexiconEntry; +import vazkii.botania.api.page.LexiconPage; + +public class PageImage extends LexiconPage { + + ResourceLocation resource; + + public PageImage(String unlocalizedName, String resource) { + super(unlocalizedName); + this.resource = new ResourceLocation(resource); + } + + @Override + public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { + TextureManager render = Minecraft.getMinecraft().renderEngine; + render.bindTexture(resource); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); + GL11.glDisable(GL11.GL_BLEND); + + int width = gui.getWidth() - 30; + int height = gui.getHeight(); + int x = gui.getLeft() + 16; + int y = gui.getTop() + height - 40; + PageText.renderText(x, y, width, height, getUnlocalizedName()); + } + +} diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageText.java b/MODSRC/vazkii/botania/common/lexicon/page/PageText.java index 8bf70fb7e..8467750ae 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageText.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageText.java @@ -31,16 +31,20 @@ public class PageText extends LexiconPage { @Override public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { - FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; - boolean unicode = renderer.getUnicodeFlag(); - renderer.setUnicodeFlag(true); - String text = StatCollector.translateToLocal(getUnlocalizedName()).replaceAll("&", "\u00a7"); - String[] textEntries = text.split("
"); - int width = gui.getWidth() - 30; int x = gui.getLeft() + 16; int y = gui.getTop(); + renderText(x, y, width, gui.getHeight(), getUnlocalizedName()); + } + + public static void renderText(int x, int y, int width, int height, String unlocalizedText) { + FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; + boolean unicode = renderer.getUnicodeFlag(); + renderer.setUnicodeFlag(true); + String text = StatCollector.translateToLocal(unlocalizedText).replaceAll("&", "\u00a7"); + String[] textEntries = text.split("
"); + String lastFormat = ""; for(String s : textEntries) { List wrappedLines = new ArrayList(); diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 639c84cdf..21a1ede75 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -34,7 +34,16 @@ botania.category.tools=Mystical Instruments botania.category.misc=Miscellaneous # LEXICON ENTRIES + +# - BASIC +# -- THE WORLD botania.entry.world=The World botania.page.world0=The world is fun.
This line of text is very long so I can test if line wrap works fine, woo.
And this one is kinda long too. &eTesting colors. &cMore colors. +botania.page.world1=This is a second page. There will be something here. Eventually. +botania.page.world2=Flowers in the wild + +# -- BASIC CONCEPTS botania.entry.basicConcepts=Basic Concepts + +# -- GETTING STARTED botania.entry.gettingStarted=Getting Started \ No newline at end of file diff --git a/resources/assets/botania/textures/flower13.png b/resources/assets/botania/textures/flower13.png deleted file mode 100644 index 84a2b6ed0..000000000 Binary files a/resources/assets/botania/textures/flower13.png and /dev/null differ diff --git a/resources/assets/botania/textures/gui/entries/flowers.png b/resources/assets/botania/textures/gui/entries/flowers.png new file mode 100644 index 000000000..266a63941 Binary files /dev/null and b/resources/assets/botania/textures/gui/entries/flowers.png differ