ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java

66 lines
2.2 KiB
Java
Raw Normal View History

/*
* This file ("GuiMainPage.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-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.gui;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
2016-11-10 21:07:15 +01:00
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
2016-11-10 22:06:58 +01:00
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
2016-11-10 21:07:15 +01:00
import java.io.IOException;
2016-11-10 22:06:58 +01:00
@SideOnly(Side.CLIENT)
public class GuiMainPage extends GuiBooklet{
2016-11-10 21:07:15 +01:00
public GuiMainPage(GuiScreen previousScreen){
super(previousScreen, null);
}
@Override
public void initGui(){
super.initGui();
2016-11-11 21:07:18 +01:00
for(int i = 0; i < BUTTONS_PER_PAGE; i++){
if(ActuallyAdditionsAPI.BOOKLET_ENTRIES.size() > i){
IBookletEntry entry = ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(i);
2016-11-12 00:29:01 +01:00
this.buttonList.add(new EntryButton(i, this.guiLeft+156, this.guiTop+11+i*13, 115, 10, "- "+entry.getLocalizedNameWithFormatting(), null));
}
else{
return;
}
}
}
2016-11-10 21:07:15 +01:00
@Override
protected void actionPerformed(GuiButton button) throws IOException{
if(button instanceof EntryButton){
if(ActuallyAdditionsAPI.BOOKLET_ENTRIES.size() > button.id){
IBookletEntry entry = ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(button.id);
if(entry != null){
2016-11-12 12:26:36 +01:00
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false));
2016-11-10 21:07:15 +01:00
}
}
}
else{
super.actionPerformed(button);
}
}
@Override
2016-11-11 18:55:32 +01:00
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer){
}
}