Added trials

This commit is contained in:
Ellpeck 2017-02-18 00:54:58 +01:00
parent d4e1fc4353
commit 2e228e6380
31 changed files with 440 additions and 14 deletions

View file

@ -81,7 +81,8 @@ public final class ActuallyAdditionsAPI{
public static IBookletEntry entryMisc; public static IBookletEntry entryMisc;
public static IBookletEntry entryUpdatesAndInfos; public static IBookletEntry entryUpdatesAndInfos;
//This is added to automatically, you don't need to add anything to this entry //This is added to automatically, you don't need to add anything to this entry
public static IBookletEntry allAndSearch; public static IBookletEntry entryAllAndSearch;
public static IBookletEntry entryTrials;
//These are getting initialized in Actually Additions' PreInit phase //These are getting initialized in Actually Additions' PreInit phase
//DO NOT CHANGE/OVERRIDE THESE!! //DO NOT CHANGE/OVERRIDE THESE!!

View file

@ -11,13 +11,17 @@
package de.ellpeck.actuallyadditions.api.booklet; package de.ellpeck.actuallyadditions.api.booklet;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IBookletChapter{ public interface IBookletChapter{
IBookletPage[] getAllPages(); IBookletPage[] getAllPages();
@SideOnly(Side.CLIENT)
String getLocalizedName(); String getLocalizedName();
@SideOnly(Side.CLIENT)
String getLocalizedNameWithFormatting(); String getLocalizedNameWithFormatting();
IBookletEntry getEntry(); IBookletEntry getEntry();

View file

@ -21,8 +21,10 @@ public interface IBookletEntry{
String getIdentifier(); String getIdentifier();
@SideOnly(Side.CLIENT)
String getLocalizedName(); String getLocalizedName();
@SideOnly(Side.CLIENT)
String getLocalizedNameWithFormatting(); String getLocalizedNameWithFormatting();
void addChapter(IBookletChapter chapter); void addChapter(IBookletChapter chapter);
@ -31,4 +33,7 @@ public interface IBookletEntry{
List<IBookletChapter> getChaptersForDisplay(String searchBarText); List<IBookletChapter> getChaptersForDisplay(String searchBarText);
int getSortingPriority(); int getSortingPriority();
@SideOnly(Side.CLIENT)
boolean visibleOnFrontPage();
} }

View file

@ -29,6 +29,7 @@ public interface IBookletPage{
void setChapter(IBookletChapter chapter); void setChapter(IBookletChapter chapter);
@SideOnly(Side.CLIENT)
String getInfoText(); String getInfoText();
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)

View file

@ -63,4 +63,6 @@ public interface IMethodHandler{
IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority); IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority);
IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages); IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages);
IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage);
} }

View file

@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement; import net.minecraft.stats.Achievement;
import net.minecraft.stats.StatisticsManager; import net.minecraft.stats.StatisticsManager;
@ -53,7 +54,8 @@ public enum TheAchievements{
GET_UNPROBED("getUnProbed", -7, 3, new ItemStack(InitItems.itemPlayerProbe), null, Type.MISC, true, 0), GET_UNPROBED("getUnProbed", -7, 3, new ItemStack(InitItems.itemPlayerProbe), null, Type.MISC, true, 0),
GET_CRYSTALS_MILESTONE("getCrystalsMilestone", 6, -3, new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), null, Type.PICK_UP, true, 200, new ItemStack(InitItems.itemCrystal, 1, Util.WILDCARD), new ItemStack(InitBlocks.blockCrystal, 1, Util.WILDCARD)), GET_CRYSTALS_MILESTONE("getCrystalsMilestone", 6, -3, new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), null, Type.PICK_UP, true, 200, new ItemStack(InitItems.itemCrystal, 1, Util.WILDCARD), new ItemStack(InitBlocks.blockCrystal, 1, Util.WILDCARD)),
OPEN_BOOKLET_MILESTONE("openBookletMilestone", 6, -1, new ItemStack(InitItems.itemBooklet), null, Type.MISC, true, 50); OPEN_BOOKLET_MILESTONE("openBookletMilestone", 6, -1, new ItemStack(InitItems.itemBooklet), null, Type.MISC, true, 50),
COMPLETE_TRIALS("completeTrials", 6, 1, new ItemStack(Items.GOLD_INGOT), null, Type.MISC, true, 0);
public final Achievement chieve; public final Achievement chieve;
public final Type type; public final Type type;

View file

@ -20,8 +20,10 @@ import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
import de.ellpeck.actuallyadditions.mod.booklet.page.*; import de.ellpeck.actuallyadditions.mod.booklet.page.*;
import de.ellpeck.actuallyadditions.mod.crafting.*; import de.ellpeck.actuallyadditions.mod.crafting.*;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
@ -44,16 +46,19 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.UniversalBucket;
import java.util.*; import java.util.*;
public final class InitBooklet{ public final class InitBooklet{
public static BookletChapter[] chaptersIntroduction = new BookletChapter[10]; public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
public static void preInit(){ public static void preInit(){
ActuallyAdditionsAPI.allAndSearch = new BookletEntryAllItems("allAndSearch").setImportant(); ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant(); ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant();
ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction"); ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction");
@ -275,5 +280,13 @@ public final class InitBooklet{
new BookletChapter("curse", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.FLINT_AND_STEEL), new PageLinkButton(1, "http://ellpeck.de/actadd")); new BookletChapter("curse", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.FLINT_AND_STEEL), new PageLinkButton(1, "http://ellpeck.de/actadd"));
new BookletChapter("patreon", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), new PageLinkButton(1, "http://patreon.com/Ellpeck"), new PagePicture(2, "page_patreon", 153)).setImportant(); new BookletChapter("patreon", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), new PageLinkButton(1, "http://patreon.com/Ellpeck"), new PagePicture(2, "page_patreon", 153)).setImportant();
new BookletChapter("website", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(InitItems.itemBooklet), new PageLinkButton(1, "http://ellpeck.de")); new BookletChapter("website", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(InitItems.itemBooklet), new PageLinkButton(1, "http://ellpeck.de"));
//Trials
chaptersIntroduction[10] = new BookletChapter("trialsIntro", ActuallyAdditionsAPI.entryTrials, new ItemStack(Items.GOLD_INGOT), new PageTextOnly(1), new PageTextOnly(2)).setSpecial();
new BookletChapterTrials("leatherProduction", new ItemStack(Items.LEATHER), false);
new BookletChapterTrials("crystalOil", UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, InitFluids.fluidCrystalOil), false);
new BookletChapterTrials("autoDisenchanter", new ItemStack(InitItems.itemDisenchantingLens), false);
new BookletChapterTrials("empoweredOil", UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, InitFluids.fluidEmpoweredOil), false);
new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false);
} }
} }

View file

@ -0,0 +1,52 @@
/*
* This file ("TrialsButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.button;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
public class TrialsButton extends TexturedButton{
private final boolean isTrials;
public TrialsButton(GuiBooklet gui){
super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft()+gui.getSizeX(), gui.getGuiTop()+10, 0, 204, 52, 16);
this.isTrials = gui.areTrialsOpened();
this.enabled = !this.isTrials;
}
@Override
public void drawButton(Minecraft minecraft, int x, int y){
super.drawButton(minecraft, x, y);
if(this.visible){
if(this.hovered || this.isTrials){
this.drawCenteredString(minecraft.fontRendererObj, StringUtil.localize("booklet."+ModUtil.MOD_ID+".trialsButton.name"), this.xPosition+(this.width-8)/2, this.yPosition+(this.height-8)/2, 14737632);
}
}
}
@Override
protected int getHoverState(boolean mouseOver){
if(mouseOver || this.isTrials){
return 2;
}
else if(!this.enabled){
return 0;
}
else{
return 1;
}
}
}

View file

@ -17,6 +17,8 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BookletChapter implements IBookletChapter{ public class BookletChapter implements IBookletChapter{
@ -51,11 +53,13 @@ public class BookletChapter implements IBookletChapter{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public String getLocalizedName(){ public String getLocalizedName(){
return StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.getIdentifier()+".name"); return StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.getIdentifier()+".name");
} }
@Override @Override
@SideOnly(Side.CLIENT)
public String getLocalizedNameWithFormatting(){ public String getLocalizedNameWithFormatting(){
return this.color+this.getLocalizedName(); return this.color+this.getLocalizedName();
} }

View file

@ -0,0 +1,45 @@
/*
* This file ("BookletChapterTrials.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BookletChapterTrials extends BookletChapter{
public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText){
super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
}
@Override
@SideOnly(Side.CLIENT)
public String getLocalizedName(){
return StringUtil.localize("booklet."+ModUtil.MOD_ID+".trials."+this.getIdentifier()+".name");
}
@Override
public String getLocalizedNameWithFormatting(){
EntityPlayer player = Minecraft.getMinecraft().player;
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
boolean completed = data.completedTrials.contains(this.getIdentifier());
return (completed ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED)+this.getLocalizedName();
}
}

View file

@ -93,11 +93,13 @@ public class BookletEntry implements IBookletEntry{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public String getLocalizedName(){ public String getLocalizedName(){
return StringUtil.localize("booklet."+ModUtil.MOD_ID+".indexEntry."+this.getIdentifier()+".name"); return StringUtil.localize("booklet."+ModUtil.MOD_ID+".indexEntry."+this.getIdentifier()+".name");
} }
@Override @Override
@SideOnly(Side.CLIENT)
public String getLocalizedNameWithFormatting(){ public String getLocalizedNameWithFormatting(){
return this.color+this.getLocalizedName(); return this.color+this.getLocalizedName();
} }
@ -140,6 +142,12 @@ public class BookletEntry implements IBookletEntry{
return this.priority; return this.priority;
} }
@Override
@SideOnly(Side.CLIENT)
public boolean visibleOnFrontPage(){
return true;
}
public BookletEntry setImportant(){ public BookletEntry setImportant(){
this.color = TextFormatting.DARK_GREEN; this.color = TextFormatting.DARK_GREEN;
return this; return this;

View file

@ -0,0 +1,23 @@
/*
* This file ("BookletEntryTrials.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.entry;
public class BookletEntryTrials extends BookletEntry{
public BookletEntryTrials(String identifier){
super(identifier, -Integer.MAX_VALUE);
}
@Override
public boolean visibleOnFrontPage(){
return false;
}
}

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.gui;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton; import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.TrialsButton;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
@ -55,6 +56,8 @@ public abstract class GuiBooklet extends GuiBookletBase{
private GuiButton buttonRight; private GuiButton buttonRight;
private GuiButton buttonBack; private GuiButton buttonBack;
private GuiButton buttonTrials;
private float smallFontSize; private float smallFontSize;
private float mediumFontSize; private float mediumFontSize;
private float largeFontSize; private float largeFontSize;
@ -130,6 +133,9 @@ public abstract class GuiBooklet extends GuiBookletBase{
} }
} }
} }
this.buttonTrials = new TrialsButton(this);
this.buttonList.add(this.buttonTrials);
} }
@Override @Override
@ -140,6 +146,7 @@ public abstract class GuiBooklet extends GuiBookletBase{
this.previousScreen = null; this.previousScreen = null;
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player); PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
data.lastOpenBooklet = this;
boolean change = false; boolean change = false;
for(int i = 0; i < this.bookmarkButtons.length; i++){ for(int i = 0; i < this.bookmarkButtons.length; i++){
@ -148,7 +155,6 @@ public abstract class GuiBooklet extends GuiBookletBase{
change = true; change = true;
} }
} }
data.lastOpenBooklet = this;
if(change){ if(change){
PacketHandlerHelper.sendPlayerDataToServer(true, 0); PacketHandlerHelper.sendPlayerDataToServer(true, 0);
@ -256,6 +262,10 @@ public abstract class GuiBooklet extends GuiBookletBase{
} }
public boolean areTrialsOpened(){
return false;
}
public boolean hasBackButton(){ public boolean hasBackButton(){
return false; return false;
} }
@ -289,7 +299,7 @@ public abstract class GuiBooklet extends GuiBookletBase{
public void onSearchBarChanged(String searchBarText){ public void onSearchBarChanged(String searchBarText){
GuiBookletBase parent = !(this instanceof GuiEntry) ? this : this.parentPage; GuiBookletBase parent = !(this instanceof GuiEntry) ? this : this.parentPage;
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.allAndSearch, 0, searchBarText, true)); this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true));
} }
@Override @Override
@ -303,6 +313,9 @@ public abstract class GuiBooklet extends GuiBookletBase{
else if(this.hasBackButton() && button == this.buttonBack){ else if(this.hasBackButton() && button == this.buttonBack){
this.onBackButtonPressed(); this.onBackButtonPressed();
} }
if(button == this.buttonTrials){
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false));
}
else if(this.hasBookmarkButtons() && button instanceof BookmarkButton){ else if(this.hasBookmarkButtons() && button instanceof BookmarkButton){
int index = ArrayUtils.indexOf(this.bookmarkButtons, button); int index = ArrayUtils.indexOf(this.bookmarkButtons, button);
if(index >= 0){ if(index >= 0){

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton; import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
@ -160,4 +161,9 @@ public class GuiEntry extends GuiBooklet{
super.onBackButtonPressed(); super.onBackButtonPressed();
} }
} }
@Override
public boolean areTrialsOpened(){
return this.entry instanceof BookletEntryTrials;
}
} }

View file

@ -204,8 +204,9 @@ public class GuiMainPage extends GuiBooklet{
} }
for(int i = 0; i < BUTTONS_PER_PAGE; i++){ for(int i = 0; i < BUTTONS_PER_PAGE; i++){
if(ActuallyAdditionsAPI.BOOKLET_ENTRIES.size() > i){ List<IBookletEntry> displayed = getDisplayedEntries();
IBookletEntry entry = ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(i); if(displayed.size() > i){
IBookletEntry entry = displayed.get(i);
this.buttonList.add(new EntryButton(this, i, this.guiLeft+156, this.guiTop+11+i*13, 115, 10, "- "+entry.getLocalizedNameWithFormatting(), null)); this.buttonList.add(new EntryButton(this, i, this.guiLeft+156, this.guiTop+11+i*13, 115, 10, "- "+entry.getLocalizedNameWithFormatting(), null));
} }
else{ else{
@ -217,8 +218,9 @@ public class GuiMainPage extends GuiBooklet{
@Override @Override
protected void actionPerformed(GuiButton button) throws IOException{ protected void actionPerformed(GuiButton button) throws IOException{
if(button instanceof EntryButton){ if(button instanceof EntryButton){
if(ActuallyAdditionsAPI.BOOKLET_ENTRIES.size() > button.id){ List<IBookletEntry> displayed = getDisplayedEntries();
IBookletEntry entry = ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(button.id); if(displayed.size() > button.id){
IBookletEntry entry = displayed.get(button.id);
if(entry != null){ if(entry != null){
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false)); this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false));
} }
@ -247,7 +249,7 @@ public class GuiMainPage extends GuiBooklet{
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player); PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
data.didBookTutorial = true; data.didBookTutorial = true;
PacketHandlerHelper.sendPlayerDataToServer(true, 1); PacketHandlerHelper.sendPlayerDataToServer(false, 1);
} }
} }
else{ else{
@ -285,4 +287,16 @@ public class GuiMainPage extends GuiBooklet{
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer){ public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer){
} }
private static List<IBookletEntry> getDisplayedEntries(){
List<IBookletEntry> displayed = new ArrayList<IBookletEntry>();
for(IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES){
if(entry.visibleOnFrontPage()){
displayed.add(entry);
}
}
return displayed;
}
} }

View file

@ -66,12 +66,13 @@ public class BookletPage implements IBookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public String getInfoText(){ public String getInfoText(){
if(this.hasNoText){ if(this.hasNoText){
return null; return null;
} }
String base = StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.chapter.getIdentifier()+".text."+this.localizationKey); String base = StringUtil.localize(this.getLocalizationKey());
base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN+""); base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN+"");
base = base.replaceAll("<item>", TextFormatting.BLUE+""); base = base.replaceAll("<item>", TextFormatting.BLUE+"");
base = base.replaceAll("<r>", TextFormatting.BLACK+""); base = base.replaceAll("<r>", TextFormatting.BLACK+"");
@ -85,6 +86,11 @@ public class BookletPage implements IBookletPage{
return base; return base;
} }
@SideOnly(Side.CLIENT)
protected String getLocalizationKey(){
return "booklet."+ModUtil.MOD_ID+".chapter."+this.chapter.getIdentifier()+".text."+this.localizationKey;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton){ public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton){

View file

@ -18,6 +18,8 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
@ -35,6 +37,7 @@ public class PageCoffeeMachine extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){ public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
@ -48,6 +51,7 @@ public class PageCoffeeMachine extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY){ public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY); super.initGui(gui, startX, startY);

View file

@ -18,6 +18,8 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
@ -31,6 +33,7 @@ public class PageCrusherRecipe extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){ public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
@ -43,6 +46,7 @@ public class PageCrusherRecipe extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY){ public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY); super.initGui(gui, startX, startY);

View file

@ -17,6 +17,8 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
@ -30,6 +32,7 @@ public class PageEmpowerer extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){ public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
@ -42,6 +45,7 @@ public class PageEmpowerer extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY){ public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY); super.initGui(gui, startX, startY);

View file

@ -18,6 +18,8 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -50,6 +52,7 @@ public class PageFurnace extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){ public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
@ -62,6 +65,7 @@ public class PageFurnace extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY){ public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY); super.initGui(gui, startX, startY);

View file

@ -14,13 +14,15 @@ import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.awt.*; import java.awt.*;
import java.net.URI; import java.net.URI;
public class PageLinkButton extends BookletPage{ public class PageLinkButton extends BookletPage{
private static int nextButtonId = 23782; public static int nextButtonId = 23782;
private final int buttonId; private final int buttonId;
private final String link; private final String link;
@ -34,6 +36,7 @@ public class PageLinkButton extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY){ public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY); super.initGui(gui, startX, startY);
@ -41,12 +44,14 @@ public class PageLinkButton extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){ public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+5); PageTextOnly.renderTextToPage(gui, this, startX+6, startY+5);
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void actionPerformed(GuiBookletBase gui, GuiButton button){ public void actionPerformed(GuiBookletBase gui, GuiButton button){
if(button.id == this.buttonId){ if(button.id == this.buttonId){
if(Desktop.isDesktopSupported()){ if(Desktop.isDesktopSupported()){

View file

@ -15,6 +15,8 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PagePicture extends BookletPage{ public class PagePicture extends BookletPage{
@ -38,6 +40,7 @@ public class PagePicture extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){ public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);

View file

@ -18,6 +18,8 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
@ -32,6 +34,7 @@ public class PageReconstructor extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){ public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
@ -44,6 +47,7 @@ public class PageReconstructor extends BookletPage{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY){ public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY); super.initGui(gui, startX, startY);

View file

@ -0,0 +1,114 @@
/*
* This file ("PageTrials.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PageTrials extends BookletPage{
@SideOnly(Side.CLIENT)
private GuiButton button;
private final int buttonId;
public PageTrials(int localizationKey, boolean button, boolean text){
super(localizationKey);
if(!text){
this.setNoText();
}
if(button){
this.buttonId = PageLinkButton.nextButtonId;
PageLinkButton.nextButtonId++;
}
else{
this.buttonId = -1;
}
}
@Override
@SideOnly(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
if(this.buttonId >= 0){
this.button = new GuiButton(this.buttonId, startX+125/2-50, startY+120, 100, 20, "");
gui.getButtonList().add(this.button);
this.updateButton();
}
}
@Override
@SideOnly(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+5);
}
@Override
@SideOnly(Side.CLIENT)
protected String getLocalizationKey(){
return "booklet."+ModUtil.MOD_ID+".trials."+this.chapter.getIdentifier()+".text."+this.localizationKey;
}
@Override
@SideOnly(Side.CLIENT)
public void actionPerformed(GuiBookletBase gui, GuiButton button){
if(this.buttonId >= 0 && button.id == this.buttonId){
EntityPlayer player = Minecraft.getMinecraft().player;
PlayerSave data = PlayerData.getDataFromPlayer(player);
String id = this.chapter.getIdentifier();
boolean completed = data.completedTrials.contains(id);
if(completed){
data.completedTrials.remove(id);
}
else{
data.completedTrials.add(id);
}
this.updateButton();
PacketHandlerHelper.sendPlayerDataToServer(false, 2);
}
else{
super.actionPerformed(gui, button);
}
}
@SideOnly(Side.CLIENT)
private void updateButton(){
if(this.buttonId >= 0 && this.button != null){
EntityPlayer player = Minecraft.getMinecraft().player;
PlayerSave data = PlayerData.getDataFromPlayer(player);
boolean completed = data.completedTrials.contains(this.chapter.getIdentifier());
if(completed){
this.button.displayString = TextFormatting.DARK_GREEN+StringUtil.localize("booklet."+ModUtil.MOD_ID+".trialFinishButton.completed.name");
}
else{
this.button.displayString = TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".trialFinishButton.uncompleted.name");
}
}
}
}

View file

@ -20,6 +20,8 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -55,6 +57,7 @@ public final class PlayerData{
public int batWingsFlyTime; public int batWingsFlyTime;
public IBookletPage[] bookmarks = new IBookletPage[12]; public IBookletPage[] bookmarks = new IBookletPage[12];
public List<String> completedTrials = new ArrayList<String>();
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public GuiBooklet lastOpenBooklet; public GuiBooklet lastOpenBooklet;
@ -73,6 +76,9 @@ public final class PlayerData{
NBTTagList bookmarks = compound.getTagList("Bookmarks", 8); NBTTagList bookmarks = compound.getTagList("Bookmarks", 8);
this.loadBookmarks(bookmarks); this.loadBookmarks(bookmarks);
NBTTagList trials = compound.getTagList("Trials", 8);
this.loadTrials(trials);
if(!savingToFile){ if(!savingToFile){
this.shouldDisableBatWings = compound.getBoolean("ShouldDisableWings"); this.shouldDisableBatWings = compound.getBoolean("ShouldDisableWings");
} }
@ -86,6 +92,7 @@ public final class PlayerData{
compound.setInteger("BatWingsFlyTime", this.batWingsFlyTime); compound.setInteger("BatWingsFlyTime", this.batWingsFlyTime);
compound.setTag("Bookmarks", this.saveBookmarks()); compound.setTag("Bookmarks", this.saveBookmarks());
compound.setTag("Trials", this.saveTrials());
if(!savingToFile){ if(!savingToFile){
compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings); compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings);
@ -112,6 +119,25 @@ public final class PlayerData{
} }
} }
} }
public NBTTagList saveTrials(){
NBTTagList trials = new NBTTagList();
for(String trial : this.completedTrials){
trials.appendTag(new NBTTagString(trial));
}
return trials;
}
public void loadTrials(NBTTagList trials){
this.completedTrials.clear();
for(int i = 0; i < trials.tagCount(); i++){
String strg = trials.getStringTagAt(i);
if(strg != null && !strg.isEmpty()){
this.completedTrials.add(strg);
}
}
}
} }

View file

@ -100,6 +100,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
if(posHit != null && posHit.getBlockPos() != null){ if(posHit != null && posHit.getBlockPos() != null){
IBlockState state = minecraft.world.getBlockState(posHit.getBlockPos()); IBlockState state = minecraft.world.getBlockState(posHit.getBlockPos());

View file

@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter; import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrafting; import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrafting;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageFurnace; import de.ellpeck.actuallyadditions.mod.booklet.page.PageFurnace;
import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture; import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture;
@ -308,4 +309,9 @@ public class MethodHandler implements IMethodHandler{
public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages){ public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages){
return new BookletChapter(identifier, entry, displayStack, priority, pages); return new BookletChapter(identifier, entry, displayStack, priority, pages);
} }
@Override
public IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage){
return new BookletChapterTrials(identifier, displayStack, textOnSecondPage);
}
} }

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.network; package de.ellpeck.actuallyadditions.mod.network;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
@ -170,6 +171,13 @@ public final class PacketHandler{
else if(type == 1){ else if(type == 1){
data.didBookTutorial = compound.getBoolean("DidBookTutorial"); data.didBookTutorial = compound.getBoolean("DidBookTutorial");
} }
else if(type == 2){
data.loadTrials(compound.getTagList("Trials", 8));
if(compound.getBoolean("Achievement")){
TheAchievements.COMPLETE_TRIALS.get(player);
}
}
WorldData.get(world).markDirty(); WorldData.get(world).markDirty();
if(compound.getBoolean("Log")){ if(compound.getBoolean("Log")){

View file

@ -10,6 +10,9 @@
package de.ellpeck.actuallyadditions.mod.network; package de.ellpeck.actuallyadditions.mod.network;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -68,6 +71,20 @@ public final class PacketHandlerHelper{
else if(type == 1){ else if(type == 1){
compound.setBoolean("DidBookTutorial", data.didBookTutorial); compound.setBoolean("DidBookTutorial", data.didBookTutorial);
} }
else if(type == 2){
compound.setTag("Trials", data.saveTrials());
int total = 0;
for(IBookletChapter chapter : ActuallyAdditionsAPI.entryTrials.getAllChapters()){
if(chapter instanceof BookletChapterTrials){
total++;
}
}
if(data.completedTrials.size() >= total){
compound.setBoolean("Achievement", true);
}
}
PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.PLAYER_DATA_TO_SERVER)); PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.PLAYER_DATA_TO_SERVER));
} }

View file

@ -811,6 +811,9 @@ achievement.actuallyadditions.openBookletMilestone.desc=Open the Manual 50 times
achievement.actuallyadditions.getUnProbed=Sneaky! achievement.actuallyadditions.getUnProbed=Sneaky!
achievement.actuallyadditions.getUnProbed.desc=Be probed by someone but sneak and notice it achievement.actuallyadditions.getUnProbed.desc=Be probed by someone but sneak and notice it
achievement.actuallyadditions.completeTrials=A Botanist's Dream
achievement.actuallyadditions.completeTrials.desc=Complete all Trials in the Manual
#Booklet Recipe Names #Booklet Recipe Names
booklet.actuallyadditions.shapelessRecipe=Shapeless Recipe booklet.actuallyadditions.shapelessRecipe=Shapeless Recipe
booklet.actuallyadditions.shapedRecipe=Shaped Recipe booklet.actuallyadditions.shapedRecipe=Shaped Recipe
@ -834,6 +837,7 @@ booklet.actuallyadditions.indexEntry.itemsRF.name=Items that use CF
booklet.actuallyadditions.indexEntry.reconstruction.name=Reconstruction booklet.actuallyadditions.indexEntry.reconstruction.name=Reconstruction
booklet.actuallyadditions.indexEntry.laserRelays.name=Laser Transport booklet.actuallyadditions.indexEntry.laserRelays.name=Laser Transport
booklet.actuallyadditions.indexEntry.updatesAndInfos.name=Updates and Infos booklet.actuallyadditions.indexEntry.updatesAndInfos.name=Updates and Infos
booklet.actuallyadditions.indexEntry.trials.name=Trials
#Booklet Font Size #Booklet Font Size
booklet.actuallyadditions.fontSize.small=0.5 booklet.actuallyadditions.fontSize.small=0.5
@ -851,6 +855,9 @@ booklet.actuallyadditions.configButton.name=Open Config GUI
booklet.actuallyadditions.configButton.desc=Press this to configure %s in-game. \nSome changes will require a game restart! booklet.actuallyadditions.configButton.desc=Press this to configure %s in-game. \nSome changes will require a game restart!
booklet.actuallyadditions.achievementButton.name=Open Achievements booklet.actuallyadditions.achievementButton.name=Open Achievements
booklet.actuallyadditions.achievementButton.desc=Press this to open the %s Achievements. booklet.actuallyadditions.achievementButton.desc=Press this to open the %s Achievements.
booklet.actuallyadditions.trialFinishButton.completed.name=Completed
booklet.actuallyadditions.trialFinishButton.uncompleted.name=Not Completed
booklet.actuallyadditions.trialsButton.name=Trials
#Booklet Info #Booklet Info
booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is disabled in the Config File! If you're on a server, ask the server author to enable it in the config. If you're on a client, press the 'Open Config'-Button on the top right and enable the recipe! booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is disabled in the Config File! If you're on a server, ask the server author to enable it in the config. If you're on a client, press the 'Open Config'-Button on the top right and enable the recipe!
@ -858,6 +865,22 @@ booklet.actuallyadditions.unavailable=Parts of this feature are currently disabl
booklet.actuallyadditions.clickToSeeRecipe=Click to see more Information booklet.actuallyadditions.clickToSeeRecipe=Click to see more Information
booklet.actuallyadditions.amountOfWordsAndChars=Total: %s words, %s characters booklet.actuallyadditions.amountOfWordsAndChars=Total: %s words, %s characters
#Booklet Trials
booklet.actuallyadditions.trials.leatherProduction.name=Leather Production
booklet.actuallyadditions.trials.leatherProduction.text.1=Automating the <item>Atomic Reconstructor<r> can be a nice thing, especially when trying to create <item>Leather<r> from <item>Rotten Flesh<r>, allowing you to finally get some use out of those nasty unwanted resources.
booklet.actuallyadditions.trials.crystalOil.name=Automate Crystallized Oil
booklet.actuallyadditions.trials.crystalOil.text.1=The first and second tier of <item>Oil<r> are very easy to create, however, if you want to create <imp>a lot more power<r>, it gets <imp>more complicated<r> the higher tier you go with. <n>Creating <item>Crystallized Oil<r> requires an automated setup that converts <item>Oil<r> in-world, requiring a <imp>more advanced setup<r>.
booklet.actuallyadditions.trials.autoDisenchanter.name=Auto-Disenchanter
booklet.actuallyadditions.trials.autoDisenchanter.text.1=Using the <item>Lens of Disenchanting<r> makes it really easy to get enchantments off of things that you don't want them on anymore, like <imp>loot from the Fishing Net<r> or dungeons and <imp>unlucky enchantments<r> on your favorite tools. <n>Automating this process would make things a lot easier.
booklet.actuallyadditions.trials.empoweredOil.name=Automate Empowered Oil
booklet.actuallyadditions.trials.empoweredOil.text.1=The <imp>demand for power<r> has been rising and rising, yet building <imp>more farms<r> just doesn't cut it? <n>You should try to <imp>upgrade<r> your <item>Oil<r> production by creating <item>Empowered Oil<r>. However, this requires a pretty advanced <imp>in-world setup<r> to get working, so it might be tricky.
booklet.actuallyadditions.trials.mobFarm.name=Monster Grinder
booklet.actuallyadditions.trials.mobFarm.text.1=Using the <item>Spawner Changer<r> or just a big empty space and some water can be a great way to <imp>get a bunch of mobs<r> to spawn. Using the <item>Lens of Death<r> or the <item>Lens of the Killer<r> allows you to efficiently kill mobs and even get <imp>special drops<r>, allowing you to create a pretty effective <imp>automatic mob farm<r>.
#Booklet Chapters #Booklet Chapters
booklet.actuallyadditions.chapter.intro.name=A story about ActAdd booklet.actuallyadditions.chapter.intro.name=A story about ActAdd
booklet.actuallyadditions.chapter.intro.text.1=<i>For too long have the people of Minecraftia toiled under a relentless whip. A whip more hurtful and more injurious than that of any slave-master: inconvenience. Aye, the thousand million inconveniences that make up the grind, that force players to waste hours- nay, days!- chopping wood and farming wheat and other such mundane tasks, just to momentarily escape the remorseless tedium and experience the true joys of Minecraftia, building, caving and adventuring into the beautiful uncharted abundance booklet.actuallyadditions.chapter.intro.text.1=<i>For too long have the people of Minecraftia toiled under a relentless whip. A whip more hurtful and more injurious than that of any slave-master: inconvenience. Aye, the thousand million inconveniences that make up the grind, that force players to waste hours- nay, days!- chopping wood and farming wheat and other such mundane tasks, just to momentarily escape the remorseless tedium and experience the true joys of Minecraftia, building, caving and adventuring into the beautiful uncharted abundance
@ -1217,3 +1240,7 @@ booklet.actuallyadditions.chapter.goggles.text.1=The <item>Engineer's Goggles<r>
booklet.actuallyadditions.chapter.crystalClusters.name=Crystal Clusters booklet.actuallyadditions.chapter.crystalClusters.name=Crystal Clusters
booklet.actuallyadditions.chapter.crystalClusters.text.1=<item>Crystal Clusters<r> are blocks that generate naturally inside of <imp>Lush Caves<r>. <n>When broken, they <imp>drop<r> one or more <item>Crystal Shards<r> that can be crafted together to create <item>Crystals<r>. <n><item>Crystal Clusters<r> emit a bit of light, making them perfect for <imp>decoration<r>. To harvest them in their block form, <imp>Silk Touch<r> can be used. booklet.actuallyadditions.chapter.crystalClusters.text.1=<item>Crystal Clusters<r> are blocks that generate naturally inside of <imp>Lush Caves<r>. <n>When broken, they <imp>drop<r> one or more <item>Crystal Shards<r> that can be crafted together to create <item>Crystals<r>. <n><item>Crystal Clusters<r> emit a bit of light, making them perfect for <imp>decoration<r>. To harvest them in their block form, <imp>Silk Touch<r> can be used.
booklet.actuallyadditions.chapter.trialsIntro.name=Intro to Trials
booklet.actuallyadditions.chapter.trialsIntro.text.1=<item>Trials<r> are a set of fun and interesting <imp>challenges<r> that you can use to <imp>get inspiration<r> on what to build next. <n>Once you <imp>complete<r> a <item>Trial<r>, you can <imp>press the button<r> in the bottom right to mark the trial as completed, turning its name in the list green. <n>Since there is <imp>no way to check<r> if a trial is actually completed, <item>Trials<r> are meant as <imp>personal goals<r>. <n><n>To <imp>visit<r> the <item>Trials<r> page, you can click the <imp>bookmark<r> in the <imp>top right<r> corner of the manual GUI.
booklet.actuallyadditions.chapter.trialsIntro.text.2=Note that <item>Trials<r> are designed in a way that they should be completed with the concepts of <imp>Minecraft<r> and <imp>Actually Additions<r> alone.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB