Rewrote the book tutorial page and added bookmarks for new users

This commit is contained in:
Ellpeck 2016-11-01 16:47:40 +01:00
parent 11b7ecb172
commit 93f957d4dd
6 changed files with 57 additions and 28 deletions

View file

@ -571,7 +571,7 @@ public final class BookletUtils{
//Save Bookmarks
NBTTagList list = new NBTTagList();
for(int i = 0; i < gui.bookmarkButtons.length; i++){
BookmarkButton button = (BookmarkButton)gui.bookmarkButtons[i];
BookmarkButton button = gui.bookmarkButtons[i];
NBTTagCompound buttonTag = new NBTTagCompound();
button.assignedEntry.writeToNBT(buttonTag);
@ -607,7 +607,7 @@ public final class BookletUtils{
NBTTagList list = compound.getTagList("Bookmarks", 10);
if(list != null){
for(int i = 0; i < list.tagCount(); i++){
BookmarkButton button = (BookmarkButton)gui.bookmarkButtons[i];
BookmarkButton button = gui.bookmarkButtons[i];
button.assignedEntry.readFromNBT(list.getCompoundTagAt(i));
}
}

View file

@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.api.internal.IEntrySet;
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.IndexButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
@ -66,7 +67,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public final int ySize;
public final IEntrySet currentEntrySet = new EntrySet(null);
public final GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT];
public final GuiButton[] bookmarkButtons = new GuiButton[8];
public final BookmarkButton[] bookmarkButtons = new BookmarkButton[8];
public final GuiScreen parentScreen;
private final boolean tryOpenMainPage;
private final boolean saveOnClose;
@ -90,6 +91,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
private int ticksElapsed;
private boolean mousePressed;
private int hisNameIsAt;
public GuiButton buttonIntroduction;
public GuiBooklet(GuiScreen parentScreen, boolean tryOpenMainPage, boolean saveOnClose){
this.xSize = 146;
@ -162,8 +164,12 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
this.currentEntrySet.getCurrentPage().render(this, x, y, this.ticksElapsed, this.mousePressed);
}
//Draws hovering texts for buttons
this.fontRendererObj.setUnicodeFlag(false);
if(this.buttonIntroduction.visible){
StringUtil.drawSplitString(this.fontRendererObj, TextFormatting.GREEN+"Hi! It looks like this is the first time you are using this manual! "+TextFormatting.RESET+"\nClick the button below to save a couple of "+TextFormatting.GOLD+"useful chapters as bookmarks"+TextFormatting.RESET+" on the bottom of the GUI! \nIf you don't want this, shift-click the button instead.", this.guiLeft+150, this.guiTop+10, 100, 0xFFFFFF, true);
}
//Draws hovering texts for buttons
BookletUtils.doHoverTexts(this, x, y);
BookletUtils.drawAchievementInfo(this, false, x, y);
@ -237,8 +243,24 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
}
}
//Handles introduction
if(button == this.buttonIntroduction){
this.buttonIntroduction.visible = false;
if(!isShiftKeyDown()){
for(int i = 0; i < InitBooklet.chaptersIntroduction.length; i++){
BookletChapter chap = InitBooklet.chaptersIntroduction[i];
this.bookmarkButtons[i].assignedEntry.setEntry(chap.getPages()[0], chap, chap.getEntry(), ActuallyAdditionsAPI.BOOKLET_ENTRIES.indexOf(chap.getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1);
}
this.shouldSaveDataNextClose = true;
}
NBTTagCompound extraData = new NBTTagCompound();
extraData.setBoolean("IntroductionDone", true);
PacketHandlerHelper.sendChangePlayerDataPacket(extraData);
}
//Handles update
if(button == this.buttonUpdate){
else if(button == this.buttonUpdate){
if(UpdateChecker.needsUpdateNotify){
BookletUtils.openBrowser(UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK);
}
@ -379,21 +401,24 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
this.currentEntrySet.removeEntry();
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(Minecraft.getMinecraft().thePlayer);
this.buttonIntroduction = new TexturedButton(-3531, this.guiLeft+150, this.guiTop+128, 245, 0, 11, 11);
this.buttonList.add(this.buttonIntroduction);
this.buttonIntroduction.visible = !data.theCompound.getBoolean("IntroductionDone");
if(ItemBooklet.forcedEntry == null){
//Open last entry or introductory entry
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(Minecraft.getMinecraft().thePlayer);
if(data != null){
if(this.tryOpenMainPage && !data.theCompound.getBoolean("BookAlreadyOpened")){
BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
if(this.tryOpenMainPage && !data.theCompound.getBoolean("BookAlreadyOpened")){
BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
NBTTagCompound extraData = new NBTTagCompound();
extraData.setBoolean("BookAlreadyOpened", true);
PacketHandlerHelper.sendChangePlayerDataPacket(extraData);
}
else{
BookletUtils.openLastBookPage(this, data.theCompound.getCompoundTag("BookletData"));
}
NBTTagCompound extraData = new NBTTagCompound();
extraData.setBoolean("BookAlreadyOpened", true);
PacketHandlerHelper.sendChangePlayerDataPacket(extraData);
}
else{
BookletUtils.openLastBookPage(this, data.theCompound.getCompoundTag("BookletData"));
}
this.shouldSaveDataNextClose = false;
}

View file

@ -54,6 +54,7 @@ public class GuiBookletStand extends GuiBooklet{
super.initGui();
//Remove Bookmark Buttons
this.buttonIntroduction.visible = false;
for(GuiButton bookmarkButton : this.bookmarkButtons){
bookmarkButton.visible = false;
}

View file

@ -48,6 +48,7 @@ import java.util.Arrays;
public final class InitBooklet{
public static BookletChapter chapterIntro;
public static BookletChapter[] chaptersIntroduction = new BookletChapter[6];
public static void preInit(){
ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant();
@ -95,8 +96,8 @@ public final class InitBooklet{
//Getting Started
chapterIntro = new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
new BookletChapter("reviews", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.BOOK), new PageTextOnly(1));
new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM")).setImportant();
new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM")).setImportant();
chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText());
ArrayList<BookletPage> crystalPages = new ArrayList<BookletPage>();
crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setPageStacksWildcard()));
for(int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++){
@ -104,8 +105,8 @@ public final class InitBooklet{
}
crystalPages.add(new PageCrafting(crystalPages.size()+1, MiscCrafting.RECIPES_CRYSTALS).setNoText());
crystalPages.add(new PageCrafting(crystalPages.size()+1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText());
new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE).setPageStacksWildcard());
chaptersIntroduction[5] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
chaptersIntroduction[4] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE).setPageStacksWildcard());
ArrayList<BookletPage> empowererPages = new ArrayList<BookletPage>();
empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "pageEmpowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand)));
for(int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++){
@ -115,13 +116,13 @@ public final class InitBooklet{
empowererPages.add(new PageCrafting(empowererPages.size()+1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText());
new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockEmpowerer), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial();
new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(7, ItemCrafting.recipeRing).setNoText(), new PageCrafting(8, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(11, ItemCrafting.recipeDough).setNoText(), new PageCrafting(12, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(13, BlockCrafting.recipeIronCase).setNoText(), new PageCrafting(14, ItemCrafting.recipeLens).setNoText()).setImportant();
new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1));
chaptersIntroduction[3] = new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1));
//Miscellaneous
new BookletChapter("worms", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemWorm), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemWorm)), new PagePicture(2, "pageWorms", 145)).setImportant();
new BookletChapter("banners", ActuallyAdditionsAPI.entryMisc, new ItemStack(Items.BANNER, 1, 15), new PageTextOnly(1));
new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText());
new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStacks(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", OreGen.QUARTZ_MIN).addTextReplacement("<highest>", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
chaptersIntroduction[2] = new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStacks(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", OreGen.QUARTZ_MIN).addTextReplacement("<highest>", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText().setPageStacksWildcard()).setSpecial();
new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
ArrayList<BookletPage> lampPages = new ArrayList<BookletPage>();

View file

@ -84,11 +84,13 @@ public class BookletChapter implements IBookletChapter{
return this.identifier;
}
public void setImportant(){
public BookletChapter setImportant(){
this.color = TextFormatting.DARK_GREEN;
return this;
}
public void setSpecial(){
public BookletChapter setSpecial(){
this.color = TextFormatting.DARK_PURPLE;
return this;
}
}

View file

@ -925,9 +925,9 @@ booklet.actuallyadditions.chapter.crystals.text.5=When you have crafted a couple
booklet.actuallyadditions.chapter.crystals.text.6=<n><n><n><i>Molecular Transformilator
booklet.actuallyadditions.chapter.bookTutorial.name=Intro to the Manual
booklet.actuallyadditions.chapter.bookTutorial.text.1=The <item>Actually Additions Manual<r> is very versatile. Here is a quick overview: <n><imp>Entries & Chapters<r><n>An Entry is a general topic while a Chapter is almost always pointed to a specific item. When closing a chapter, the index opens, when closing that, the front page will. <n><imp>Bookmarks<r><n>Bookmarks, as seen on the bottom of the booklet, store the current page when clicked and can restore said page when clicked again. This can be very useful for easy navigation.
booklet.actuallyadditions.chapter.bookTutorial.text.2=<imp>The Buttons at the top right<r> lead you to the Achievements or Configuration Screen. When looking at a chapter that is somehow connected to an achievement, a speech bubble that you can hover over to see the Achievement in question will point to the Achievements Button. <n><imp>The Buttons on the top left<r> can be used to be directed to various Webpages that have to do with the mod. <n>When an update is available, a button to download it will also show up on the top left.
booklet.actuallyadditions.chapter.bookTutorial.text.3=If you, for some reason, want to craft this book again, just take a <item>piece of paper<r> and a <item>canola seed<r> which you can find randomly generated and craft them together!
booklet.actuallyadditions.chapter.bookTutorial.text.1=The <item>Actually Additions Manual<r> is the place to get <imp>information about the mod<r> in lots of different ways. It contains <imp>in-depth descriptions<r> of features and more. <n><n>Here is a quick overview: <n>The <item>orange buttons<r> on the bottom of the page, from left to right, can be used to <imp>go a page to the left<r> in the current chapter, <imp>go back one level<r>, and to <imp>go a page to the right<r> in the current chapter. <n><n><i>Press the button on the right to turn the page.
booklet.actuallyadditions.chapter.bookTutorial.text.2=The manual is split into <imp>three main parts<r> of hierarchy. There is the <item>front page<r>, multiple <item>overwiew pages for specific topics<r> or chapters and <item>chapters<r> themselves. As said before, the <item>orange button in the middle<r> can be used to go back a level. <n><n>There are also a variety of <imp>other functions<r>. In the bottom right, you can see a <item>search bar<r>. Once clicked on, this will allow you to <imp>search for items and chapters<r> via key words. <n><n><i>Turn the page again now.
booklet.actuallyadditions.chapter.bookTutorial.text.3=The <item>bookmarks<r> on the bottom can store different pages and chapters <imp>for later use<r>. Hover over them to see how they work. <n><n>At the top, there is a variety of buttons <imp>linking to other things<r>. Mainly, on the top right, there is a <item>config button<r> and an <item>achievement button<r>. These can be used to quickly access said things. <n><n><i>Once you are done reading this chapter, press the middle orange button on the bottom twice to reach the index.
booklet.actuallyadditions.chapter.reconstructorLenses.name=Intro to Lenses
booklet.actuallyadditions.chapter.reconstructorLenses.text.1=The <item>Atomic Reconstructor<r>, by default, can only convert some blocks. <n>This can be changed, however, with <item>Lenses<r>. They can be attached to the Reconstructor via <imp>right-clicking<r> with them in hand. To remove them, right-click with an empty hand. <n>They all use a different amount of power and will only activate <imp>once they have it<r>. <n><item>Lenses<r> have lots of different features and uses, as you can see in <imp>this chapter<r>. <n>However, there is also some <imp>other useful recipes<r> too.