diff --git a/src/main/java/vazkii/botania/client/core/handler/PersistentVariableHelper.java b/src/main/java/vazkii/botania/client/core/handler/PersistentVariableHelper.java index 49c0bd42b..0692a4249 100644 --- a/src/main/java/vazkii/botania/client/core/handler/PersistentVariableHelper.java +++ b/src/main/java/vazkii/botania/client/core/handler/PersistentVariableHelper.java @@ -109,10 +109,8 @@ public final class PersistentVariableHelper { lastBotaniaVersion = cmp.hasKey(TAG_LAST_BOTANIA_VERSION) ? cmp.getString(TAG_LAST_BOTANIA_VERSION) : "(N/A)"; firstLoad = cmp.hasKey(TAG_FIRST_LOAD) ? cmp.getBoolean(TAG_FIRST_LOAD) : firstLoad; - if(firstLoad) { - GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(LexiconData.welcome, new GuiLexiconEntry(LexiconData.tutorial, new GuiLexicon())); + if(firstLoad) lastBotaniaVersion = LibMisc.VERSION; - } } public static void saveSafe() { diff --git a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java index 8f50f6f8b..a36ea21d4 100644 --- a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java @@ -171,6 +171,7 @@ import vazkii.botania.common.entity.EntityVineBall; import vazkii.botania.common.item.ItemSextant.MultiblockSextant; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.item.equipment.bauble.ItemMonocle; +import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibObfuscation; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -359,6 +360,12 @@ public class ClientProxy extends CommonProxy { public void setEntryToOpen(LexiconEntry entry) { GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(entry, new GuiLexiconIndex(entry.category)); } + + @Override + public void setToTutorialIfFirstLaunch() { + if(PersistentVariableHelper.firstLoad) + GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(LexiconData.welcome, new GuiLexiconEntry(LexiconData.tutorial, new GuiLexicon())).setFirstEntry(); + } @Override public void setLexiconStack(ItemStack stack) { diff --git a/src/main/java/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java b/src/main/java/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java index 73c54230c..f395c9eba 100644 --- a/src/main/java/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java +++ b/src/main/java/vazkii/botania/client/gui/lexicon/GuiLexiconEntry.java @@ -42,6 +42,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa private static final String TAG_PAGE = "page"; public int page = 0; + public boolean firstEntry = false; LexiconEntry entry; GuiScreen parent; String title; @@ -178,10 +179,17 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa updatePageButtons(); currentPage.onActionPerformed(this, par1GuiButton); } + + public GuiLexiconEntry setFirstEntry() { + firstEntry = true; + return this; + } public void updatePageButtons() { leftButton.enabled = page != 0; rightButton.enabled = page + 1 < entry.pages.size(); + if(firstEntry) + backButton.enabled = !rightButton.enabled; } @Override diff --git a/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonBack.java b/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonBack.java index 465127cad..05c3bfaca 100644 --- a/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonBack.java +++ b/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonBack.java @@ -29,17 +29,19 @@ public class GuiButtonBack extends GuiButtonLexicon { @Override public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; - int k = getHoverState(field_146123_n); - - par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture); - GL11.glColor4f(1F, 1F, 1F, 1F); - drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9); - - List tooltip = getTooltip(); - int tooltipY = (tooltip.size() - 1) * 10; - if(k == 2) - RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip); + if(enabled) { + field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; + int k = getHoverState(field_146123_n); + + par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture); + GL11.glColor4f(1F, 1F, 1F, 1F); + drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9); + + List tooltip = getTooltip(); + int tooltipY = (tooltip.size() - 1) * 10; + if(k == 2) + RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip); + } } public List getTooltip() { diff --git a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java index 6f3951d7e..102711d00 100644 --- a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java @@ -27,6 +27,9 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.ITwoNamedPage; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconPage; +import vazkii.botania.client.core.handler.PersistentVariableHelper; +import vazkii.botania.client.gui.lexicon.GuiLexicon; +import vazkii.botania.client.gui.lexicon.GuiLexiconEntry; import vazkii.botania.common.Botania; import vazkii.botania.common.achievement.ModAchievements; import vazkii.botania.common.block.ModBlocks; @@ -189,6 +192,10 @@ public class CommonProxy { public void setEntryToOpen(LexiconEntry entry) { // NO-OP } + + public void setToTutorialIfFirstLaunch() { + // NO-OP + } public void setLexiconStack(ItemStack stack) { // NO-OP diff --git a/src/main/java/vazkii/botania/common/item/ItemLexicon.java b/src/main/java/vazkii/botania/common/item/ItemLexicon.java index 98ad09bf9..e75ee4b71 100644 --- a/src/main/java/vazkii/botania/common/item/ItemLexicon.java +++ b/src/main/java/vazkii/botania/common/item/ItemLexicon.java @@ -13,6 +13,7 @@ package vazkii.botania.common.item; import java.util.ArrayList; import java.util.List; +import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraft.block.Block; import net.minecraft.client.gui.GuiScreen; import net.minecraft.creativetab.CreativeTabs; @@ -34,11 +35,15 @@ import vazkii.botania.api.lexicon.ILexiconable; import vazkii.botania.api.lexicon.KnowledgeType; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.recipe.IElvenItem; +import vazkii.botania.client.core.handler.ClientTickHandler; +import vazkii.botania.client.gui.lexicon.GuiLexicon; +import vazkii.botania.client.gui.lexicon.GuiLexiconEntry; import vazkii.botania.common.Botania; import vazkii.botania.common.achievement.ModAchievements; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.core.helper.MathHelper; import vazkii.botania.common.item.relic.ItemDice; +import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibGuiIDs; import vazkii.botania.common.lib.LibItemNames; import vazkii.botania.common.lib.LibMisc; @@ -135,7 +140,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem { else par3EntityPlayer.addChatMessage(new ChatComponentTranslation("botaniamisc.cantOpen").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); setForcedPage(par1ItemStack, ""); } - + openBook(par3EntityPlayer, par1ItemStack, par2World, skipSound); skipSound = false; @@ -144,6 +149,8 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem { public static void openBook(EntityPlayer player, ItemStack stack, World world, boolean skipSound) { ILexicon l = (ILexicon) stack.getItem(); + + Botania.proxy.setToTutorialIfFirstLaunch(); if(!l.isKnowledgeUnlocked(stack, BotaniaAPI.relicKnowledge) && l.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) for(ItemStack rstack : ItemDice.relicStacks) { diff --git a/src/main/java/vazkii/botania/common/lexicon/WLexiconEntry.java b/src/main/java/vazkii/botania/common/lexicon/WLexiconEntry.java index 56882d9fc..26d745ec6 100644 --- a/src/main/java/vazkii/botania/common/lexicon/WLexiconEntry.java +++ b/src/main/java/vazkii/botania/common/lexicon/WLexiconEntry.java @@ -20,7 +20,7 @@ import vazkii.botania.common.lib.LibLexicon; public class WLexiconEntry extends BLexiconEntry { - private static final int PAGES = 9; + private static final int PAGES = 7; public WLexiconEntry() { super(LibLexicon.BASICS_WELCOME, BotaniaAPI.categoryBasics); diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index 210fd99c3..6d20f51a0 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -1947,15 +1947,13 @@ botania.category.misc=Miscellaneous # -- WELCOME TO BOTANIA botania.entry.welcome=Welcome To Botania botania.tagline.welcome=Welcome to the Hotel Botania -botania.page.welcome0=&oWhat is peace? Is it truly just a lack of combat? Is it years of sitting quietly in a garden, surrounded by flowers? Is it watching over a kingdom that you are able to call your own? Is it the completion of almost every task known to man? Is it the ability to watch numbers of resources steadily rise as you watch your collection grow? -botania.page.welcome1=&oIs peace something that can be obtained easily, without work - or is it something difficult to obtain?
Let's say for a moment - not even a second - that peace is truly just a lack of work; peaceful days surrounded by flowers. -botania.page.welcome2=&oYears spent watching time tick by while you watch your flora perform every single task imaginable, without outside help from polluting machines or computers tangled in cables and pipes.
Now imagine that everything we just talked about was possible. -botania.page.welcome3=&oImagine that through your hard labor - your cultivation of flowers, your manipulation of mana, your knowledge of the mechanisms of the world and redstone - you could obtain that dreamlike state. Imagine that you could have everything you could ever desire automated with flora. Flora, some magic, and your own ingenuity. -botania.page.welcome4=&oWith the help of this book, your dreams will become a reality.
The name of this book is deceptive. Despite being called the Lexica Botania, this tome focuses on far more than just flowers. It focuses on a variety of devices, both magical and bordering on technological. -botania.page.welcome5=&oIt holds the secrets of the elves, who have long ago fled from this world, as well as possible clues to the origins of the very world itself. For anyone with a basic knowledge of redstone and the creativity to put it to use, this book offers answers to nearly every problem known to man, without the need to use foreign schools of magic or machinery. -botania.page.welcome6=&oThis book contains instructions on how to perform nearly every task that one could ever need, with only the use of what's in it, and available in the world of Minecraft, assuming you're up to the task of putting them together in ingenious ways.
Try it out, you'll be amazed at what you can do without outside interference. -botania.page.welcome7=&oThe school of botany does not solely apply to those with a knack for complex thought processes.
Introduction to the art is simple, and the rewards are vast. A wide range of magical accessories and instruments allow for empowering of one who decides to study the various options therein. -botania.page.welcome8=&oDear reader, I welcome you to the realm of Botania.&r
- Written by &nGideon Seymour&r, guest writer. (Adapted for use)

&oClick the "Back" arrow at the bottom to leave this entry +botania.page.welcome0=&oWelcome to Botania! I congratulate you on the fine choice of strapping a sapling and a book together, or just finding this tome in a chest. Whichever applies.
&oYou can navigate this book using the arrows at the bottom of this page, your mouse wheel or the arrow keys in your keyboard. +botania.page.welcome1=&oDespite its looks, Botania is in essence a "tech mod", by definition of requiring you to put to use ingenuity, thought and redstone to create and progress. It's good to keep that in mind.
&oOf course you'll also be rewarded with cool toys, blocks and equipment, if you're worried. +botania.page.welcome2=&oFor all intents and purposes, Botania is a mod that anybody who likes to play the game with the primary purpose of building cool things will likely enjoy. It is designed to be fully playable standalone, but is also playable with other mods.
&oExcluding a small few examples, everything in the mod is fully automatable using minecraft and its own features exclusively. +botania.page.welcome3=&oIf you happen to find yourself lost, try checking out the mod's Achievements or Challenges, both of which can be found on the left hand side of this book's main page.
&oThe book is laid out in a friendly way with a good amount of handy features, so before you start jumping in and playing, take a bit of time to familiarize yourself with what the various tidbits around the place do. +botania.page.welcome4=&oAfter this you'll be taken to a page where you can optionally start a tutorial that will teach you the basics of the mod in around ten minutes, give or take.
&oHowever, it teaches you only the very basics. So, after you got a good foothold on those concepts, further research is a good idea. +botania.page.welcome5=&oIf you're unsure as to what you want to learn about, hold SHIFT while browsing through the various categories to get a quick idea of what each thing is.
&oThe "Lexicon Index" category can be very helpful for searching, as it contains every entry in the book in one place. +botania.page.welcome6=&oAnd that's it for this introduction! You can move on to the tutorial now. I hope you enjoy playing with Botania as much as I enjoyed making it!
&o~Vazkii, the mod author

&oCarry on by pressing the "Back" button on the bottom. Your right mouse button or backspace key will have the same effect. # -- TUTORIAL OF THE BASICS botania.entry.tutorial=A Tutorial of the Basics