Made the achievement and config button appear right away after the tutorial

Closes #380
This commit is contained in:
Ellpeck 2016-11-20 14:51:21 +01:00
parent 504835246c
commit af7d0d2f1d

View file

@ -34,7 +34,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -90,14 +89,6 @@ public class GuiMainPage extends GuiBooklet{
this.quoteGuy = quoteSplit[1]; this.quoteGuy = quoteSplit[1];
} }
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.thePlayer);
if(!data.didBookTutorial){
this.showTutorial = true;
this.tutorialButton = new GuiButton(666666, this.guiLeft+140/2-50, this.guiTop+146, 100, 20, "Please click me <3");
this.buttonList.add(this.tutorialButton);
}
else{
List<String> configText = new ArrayList<String>(); List<String> configText = new ArrayList<String>();
configText.add(TextFormatting.GOLD+"Open Config GUI"); configText.add(TextFormatting.GOLD+"Open Config GUI");
configText.addAll(this.fontRendererObj.listFormattedStringToWidth("Press this to configure "+ModUtil.NAME+" in-game. \nSome changes will require a game restart!", 200)); configText.addAll(this.fontRendererObj.listFormattedStringToWidth("Press this to configure "+ModUtil.NAME+" in-game. \nSome changes will require a game restart!", 200));
@ -109,6 +100,16 @@ public class GuiMainPage extends GuiBooklet{
achievementText.addAll(this.fontRendererObj.listFormattedStringToWidth("Press this to open the "+ModUtil.NAME+" Achievements.", 200)); achievementText.addAll(this.fontRendererObj.listFormattedStringToWidth("Press this to open the "+ModUtil.NAME+" Achievements.", 200));
this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText); this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText);
this.buttonList.add(this.achievementButton); this.buttonList.add(this.achievementButton);
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.thePlayer);
if(!data.didBookTutorial){
this.showTutorial = true;
this.tutorialButton = new GuiButton(666666, this.guiLeft+140/2-50, this.guiTop+146, 100, 20, "Please click me <3");
this.buttonList.add(this.tutorialButton);
this.configButton.visible = false;
this.achievementButton.visible = false;
} }
for(int i = 0; i < BUTTONS_PER_PAGE; i++){ for(int i = 0; i < BUTTONS_PER_PAGE; i++){
@ -150,6 +151,9 @@ public class GuiMainPage extends GuiBooklet{
this.showTutorial = false; this.showTutorial = false;
this.tutorialButton.visible = false; this.tutorialButton.visible = false;
this.configButton.visible = true;
this.achievementButton.visible = true;
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.thePlayer); PlayerSave data = PlayerData.getDataFromPlayer(this.mc.thePlayer);
data.didBookTutorial = true; data.didBookTutorial = true;
PacketHandlerHelper.sendPlayerDataPacket(this.mc.thePlayer, true, false); PacketHandlerHelper.sendPlayerDataPacket(this.mc.thePlayer, true, false);