diff --git a/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java b/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java index 4ab7bd7b2..a56421f58 100644 --- a/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java +++ b/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java @@ -39,6 +39,14 @@ public abstract class LexiconPage { public void updateScreen() { // NO-OP } + + /** + * Called when a key is pressed. + */ + @SideOnly(Side.CLIENT) + public void onKeyPressed(char c, int key) { + // NO-OP + } /** * Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called. diff --git a/MODSRC/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java b/MODSRC/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java index 12454253e..a1daf2500 100644 --- a/MODSRC/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java +++ b/MODSRC/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java @@ -200,6 +200,9 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa @Override protected void keyTyped(char par1, int par2) { + LexiconPage page = entry.pages.get(this.page); + page.onKeyPressed(par1, par2); + if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up prevPage(); else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index 5ffaf2e24..1f5fb8f0e 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -31,6 +31,7 @@ import vazkii.botania.common.crafting.ModRuneRecipes; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lexicon.page.PageCraftingRecipe; import vazkii.botania.common.lexicon.page.PageElvenRecipe; +import vazkii.botania.common.lexicon.page.PageGuide; import vazkii.botania.common.lexicon.page.PageImage; import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe; import vazkii.botania.common.lexicon.page.PagePetalRecipe; @@ -51,6 +52,7 @@ public final class LexiconData { public static LexiconCategory categoryAlfhomancy; public static LexiconCategory categoryMisc; + public static LexiconEntry introVideo; public static LexiconEntry flowers; public static LexiconEntry apothecary; public static LexiconEntry lexicon; @@ -199,6 +201,9 @@ public final class LexiconData { BotaniaAPI.addCategory(categoryMisc = new LexiconCategory(LibLexicon.CATEGORY_MISC)); // BASICS ENTRIES + introVideo = new BLexiconEntry(LibLexicon.BASICS_INTRO_VIDEO, categoryBasics); + introVideo.setPriority().setLexiconPages(new PageGuide("0")); + flowers = new BLexiconEntry(LibLexicon.BASICS_FLOWERS, categoryBasics); flowers.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_FLOWERS), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipesPetals), new PageCraftingRecipe("4", ModCrafingRecipes.recipePestleAndMortar), new PageCraftingRecipe("5", ModCrafingRecipes.recipesDyes), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipeFertilizerPowder), new PageCraftingRecipe("8", ModCrafingRecipes.recipeFerilizerDye)); diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageGuide.java b/MODSRC/vazkii/botania/common/lexicon/page/PageGuide.java new file mode 100644 index 000000000..42e486125 --- /dev/null +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageGuide.java @@ -0,0 +1,35 @@ +/** + * 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 @ [Sep 3, 2014, 9:41:47 PM (GMT)] + */ +package vazkii.botania.common.lexicon.page; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +public class PageGuide extends PageText { + + public PageGuide(String unlocalizedName) { + super(unlocalizedName); + } + + @Override + public void onKeyPressed(char c, int key) { + if(key == 28 && Desktop.isDesktopSupported()) + try { + Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=rx0xyejC6fI")); + if(Math.random() > 0.01) + Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=dQw4w9WgXcQ")); + } catch(Exception e) { } + } + +} diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index 42a3a255c..f85e10b5e 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -25,6 +25,7 @@ public final class LibLexicon { public static final String CATEGORY_ALFHOMANCY = CATEGORY_PREFIX + "alfhomancy"; public static final String CATEGORY_MISC = CATEGORY_PREFIX + "misc"; + public static final String BASICS_INTRO_VIDEO = "introVideo"; public static final String BASICS_FLOWERS = "flowers"; public static final String BASICS_APOTHECARY = "apothecary"; public static final String BASICS_LEXICON = "lexicon"; diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 65dab4409..d59dfdc67 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -727,6 +727,10 @@ botania.category.misc=Miscellaneous # LEXICON ENTRIES # - BASIC +# -- AN INTRODUCTORY CLIP +botania.entry.introVideo=An Introductory Clip +botania.page.introVideo0=For those readers who are not quite readers, a short video guide covering the basics of Botania is also available. It's to keep in note that this guide acts as an aid and not a substitution for the contents of the &1Lexica Botania&0.
To watch this video simply press the &4ENTER&0 key. + # -- LEXICA BOTANIA botania.entry.lexicon=Lexica Botania botania.page.lexicon0=The &1Lexica Botania&0 is the repository of all knowledge for all botany related matters. But you probably knew that already.
All information is stored here, as expected. For convenience, if a block happens to have an entry, it can be shift-right clicked with the &1Lexica Botania&0 to open that entry.