mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 12:19:46 +00:00
Rewrote the "Welcome to Botania" entry.
This commit is contained in:
1 parent
ccb1fa8651
commit
4610f1e617
8 files changed
+52
-25
No files matched your search
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<String> 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<String> tooltip = getTooltip();
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getTooltip() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user