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,25 +89,27 @@ public class GuiMainPage extends GuiBooklet{
this.quoteGuy = quoteSplit[1]; this.quoteGuy = quoteSplit[1];
} }
List<String> configText = new ArrayList<String>();
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));
this.configButton = new TexturedButton(RES_LOC_GADGETS, -388, this.guiLeft+16, this.guiTop+this.ySize-30, 188, 14, 16, 16, configText);
this.buttonList.add(this.configButton);
List<String> achievementText = new ArrayList<String>();
achievementText.add(TextFormatting.GOLD+"Open Achievements");
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.buttonList.add(this.achievementButton);
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.thePlayer); PlayerSave data = PlayerData.getDataFromPlayer(this.mc.thePlayer);
if(!data.didBookTutorial){ if(!data.didBookTutorial){
this.showTutorial = true; this.showTutorial = true;
this.tutorialButton = new GuiButton(666666, this.guiLeft+140/2-50, this.guiTop+146, 100, 20, "Please click me <3"); 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.buttonList.add(this.tutorialButton);
}
else{
List<String> configText = new ArrayList<String>();
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));
this.configButton = new TexturedButton(RES_LOC_GADGETS, -388, this.guiLeft+16, this.guiTop+this.ySize-30, 188, 14, 16, 16, configText);
this.buttonList.add(this.configButton);
List<String> achievementText = new ArrayList<String>(); this.configButton.visible = false;
achievementText.add(TextFormatting.GOLD+"Open Achievements"); this.achievementButton.visible = false;
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.buttonList.add(this.achievementButton);
} }
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);