Added version page
This commit is contained in:
parent
7f889958a2
commit
6f549337cd
3 changed files with 79 additions and 4 deletions
|
@ -40,7 +40,5 @@ public class VersionCheckerClient {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import techreborn.pda.pages.CraftingInfoPage;
|
|||
import techreborn.pda.pages.IndexPage;
|
||||
import techreborn.pda.pages.ItemsPage;
|
||||
import techreborn.pda.pages.TitledPage;
|
||||
import techreborn.pda.pages.VersionPage;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiManual extends GuiScreen{
|
||||
|
@ -50,8 +51,7 @@ public class GuiManual extends GuiScreen{
|
|||
pageCollection.addPage(new ItemsPage("POWER_GENERATION", pageCollection, "POWER_GENERATION_PAGE"));
|
||||
pageCollection.addPage(new ItemsPage("POWER_STORAGE", pageCollection, "POWER_STORAGE_PAGE"));
|
||||
pageCollection.addPage(new ItemsPage("MULTIBLOCK", pageCollection, "MULTIBLOCK_PAGE"));
|
||||
|
||||
|
||||
pageCollection.addPage(new VersionPage("VERSION", pageCollection, "VERSION PAGE", 777777));
|
||||
|
||||
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Aesu), ""));
|
||||
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloyFurnace), ""));
|
||||
|
|
77
src/main/java/techreborn/pda/pages/VersionPage.java
Normal file
77
src/main/java/techreborn/pda/pages/VersionPage.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package techreborn.pda.pages;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.Drawable;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import cpw.mods.fml.client.GuiModList;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.GuiUtil;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.pda.PageCollection;
|
||||
|
||||
public class VersionPage extends TitledPage{
|
||||
|
||||
private List<String> formattedDescription;
|
||||
private String rawDescription;
|
||||
|
||||
public VersionPage(String name, PageCollection collection, String unlocalizedTitle, int colour) {
|
||||
super(name, false, collection, unlocalizedTitle, 77777);
|
||||
rawDescription = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
|
||||
addDescription(mc, offsetX, offsetY);
|
||||
addChangelog(mc, offsetX, offsetY);
|
||||
addChangelog2(mc, offsetX, offsetY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void addDescription(Minecraft minecraft, int offsetX, int offsetY){
|
||||
GL11.glPushMatrix();
|
||||
this.drawCenteredString(minecraft.fontRenderer, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777);
|
||||
this.drawCenteredString(minecraft.fontRenderer, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void addChangelog(Minecraft minecraft, int offsetX, int offsetY){
|
||||
GL11.glPushMatrix();
|
||||
this.drawCenteredString(minecraft.fontRenderer, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void addChangelog2(Minecraft minecraft, int offsetX, int offsetY){
|
||||
ArrayList<String> changeLog = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.7F, 0.7F, 0.7F);
|
||||
|
||||
int y = offsetY + 105;
|
||||
for (String change : changeLog) {
|
||||
drawCenteredString(minecraft.fontRenderer, change, offsetX + 230, y, Color.white.getRGB());
|
||||
y += 10;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue