Search in sources :

Example 1 with BookButton

use of com.mart.solar.client.gui.button.BookButton in project Solar by Martacus.

the class GuiCategory method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) throws IOException {
    super.actionPerformed(button);
    if (button instanceof BookButton) {
        BookButton bookButton = (BookButton) button;
        bookButton.openPage();
    }
}
Also used : BookButton(com.mart.solar.client.gui.button.BookButton)

Example 2 with BookButton

use of com.mart.solar.client.gui.button.BookButton in project Solar by Martacus.

the class GuiCategory method initGui.

@Override
public void initGui() {
    super.initGui();
    int xOffset = 20;
    int yOffset = 25;
    int x = (this.width - WIDTH) / 2;
    int y = (this.height - HEIGHT) / 2;
    EntityPlayerSP player = this.mc.player;
    PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(player);
    int buttonAmount = 0;
    for (GuiPage guiPage : this.pages) {
        if (save.acquiredPages.contains(guiPage.getPageID())) {
            BookButton button = new BookButton(guiPage, x + xOffset, y + yOffset + (buttonAmount * 10), buttonAmount);
            this.addButton(button);
            buttonAmount++;
        }
    }
}
Also used : GuiPage(com.mart.solar.client.gui.pages.GuiPage) BookButton(com.mart.solar.client.gui.button.BookButton) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) PlayerData(com.mart.solar.common.data.PlayerData)

Aggregations

BookButton (com.mart.solar.client.gui.button.BookButton)2 GuiPage (com.mart.solar.client.gui.pages.GuiPage)1 PlayerData (com.mart.solar.common.data.PlayerData)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1