TechReborn/src/main/java/techreborn/manual/pages/ContentsPage.java

59 lines
2.5 KiB
Java
Raw Normal View History

2016-02-25 19:25:52 +01:00
package techreborn.manual.pages;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import techreborn.init.ModBlocks;
2016-02-26 15:35:13 +01:00
import techreborn.init.ModItems;
2016-02-25 19:25:52 +01:00
import techreborn.items.ItemPlates;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
2016-02-26 13:56:15 +01:00
import techreborn.manual.util.GuiButtonItemTexture;
2016-02-25 19:25:52 +01:00
2016-03-27 18:41:56 +02:00
import java.awt.*;
2016-10-08 21:46:16 +02:00
public class ContentsPage extends TitledPage {
public ContentsPage(String name, PageCollection collection) {
2016-03-25 10:47:34 +01:00
super(name, false, collection, Reference.CONTENTS_KEY, Color.white.getRGB());
}
2016-02-25 19:25:52 +01:00
2016-03-25 10:47:34 +01:00
@SuppressWarnings("unchecked")
@Override
2016-10-08 21:46:16 +02:00
public void initGui() {
2016-03-25 10:47:34 +01:00
buttonList.clear();
buttonList.add(new GuiButtonItemTexture(0, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
2016-10-08 21:46:16 +02:00
ItemPlates.getPlateByName("iron"), Reference.pageNames.GETTINGSTARTED_PAGE,
ttl(Reference.GETTINGSTARTED_KEY)));
2016-03-25 10:47:34 +01:00
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
new ItemStack(ModBlocks.SOLID_FUEL_GENEREATOR), Reference.pageNames.GENERATINGPOWER_PAGE,
2016-10-08 21:46:16 +02:00
ttl(Reference.GENERATINGPOWER_KEY)));
2016-03-25 10:47:34 +01:00
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
new ItemStack(ModBlocks.ELECTRIC_FURNACE), Reference.pageNames.BASICMACHINES_PAGE,
2016-10-08 21:46:16 +02:00
ttl(Reference.BASICMACHINES_KEY)));
2016-03-25 10:47:34 +01:00
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE), Reference.pageNames.ADVANCEDMACHINES_PAGE,
2016-10-08 21:46:16 +02:00
ttl(Reference.ADVANCEDMACHINES_KEY)));
2016-03-25 10:47:34 +01:00
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
new ItemStack(ModItems.STEEL_DRILL), Reference.pageNames.TOOLS_PAGE, ttl(Reference.TOOLS_KEY)));
2016-03-25 10:47:34 +01:00
}
2016-02-25 19:25:52 +01:00
2016-03-25 10:47:34 +01:00
@Override
2016-10-08 21:46:16 +02:00
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
2016-03-25 10:47:34 +01:00
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
2016-02-25 19:25:52 +01:00
2016-03-25 10:47:34 +01:00
@Override
2016-10-08 21:46:16 +02:00
public void actionPerformed(GuiButton button) {
2016-03-25 10:47:34 +01:00
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.GETTINGSTARTED_PAGE);
if (button.id == 1)
collection.changeActivePage(Reference.pageNames.GENERATINGPOWER_PAGE);
if (button.id == 2)
collection.changeActivePage(Reference.pageNames.BASICMACHINES_PAGE);
if (button.id == 3)
collection.changeActivePage(Reference.pageNames.ADVANCEDMACHINES_PAGE);
if (button.id == 4)
collection.changeActivePage(Reference.pageNames.TOOLS_PAGE);
}
2016-02-25 19:25:52 +01:00
}