Search in sources :

Example 1 with IPanelButton

use of betterquesting.api2.client.gui.controls.IPanelButton in project BetterQuesting by Funwayguy.

the class GuiQuestLines method onButtonPress.

private void onButtonPress(PEventButton event) {
    Minecraft mc = Minecraft.getMinecraft();
    IPanelButton btn = event.getButton();
    if (// Exit
    btn.getButtonID() == 0) {
        mc.displayGuiScreen(this.parent);
    } else if (// Quest Line Select
    btn.getButtonID() == 1 && btn instanceof PanelButtonStorage) {
        for (PanelButtonStorage b : qlBtns) {
            if (b.getStoredValue() == selectedLine) {
                b.setBtnState(true);
                break;
            }
        }
        @SuppressWarnings("unchecked") IQuestLine ql = ((PanelButtonStorage<IQuestLine>) btn).getStoredValue();
        selectedLine = ql;
        selectedLineId = QuestLineDatabase.INSTANCE.getKey(ql);
        cvQuest.setQuestLine(ql);
        paDesc.setText(I18n.format(ql.getUnlocalisedDescription()));
        cvDesc.refreshScrollBounds();
        scDesc.setEnabled(cvDesc.getScrollBounds().getHeight() > 0);
        btn.setBtnState(false);
    } else if (// Quest Instance Select
    btn.getButtonID() == 2 && btn instanceof PanelButtonStorage) {
        @SuppressWarnings("unchecked") IQuest quest = ((PanelButtonStorage<IQuest>) btn).getStoredValue();
        GuiHome.bookmark = new GuiQuest(this, QuestDatabase.INSTANCE.getKey(quest));
        this.lastScrollX = cvQuest.getScrollX();
        this.lastScrollY = cvQuest.getScrollY();
        this.lastZoom = cvQuest.getZoom();
        mc.displayGuiScreen(GuiHome.bookmark);
    } else if (btn.getButtonID() == 3) {
        mc.displayGuiScreen(new GuiQuestLineEditorA(this));
    }
}
Also used : IQuest(betterquesting.api.questing.IQuest) IQuestLine(betterquesting.api.questing.IQuestLine) IPanelButton(betterquesting.api2.client.gui.controls.IPanelButton) PanelButtonStorage(betterquesting.api2.client.gui.controls.PanelButtonStorage) Minecraft(net.minecraft.client.Minecraft) GuiQuestLineEditorA(betterquesting.client.gui.editors.GuiQuestLineEditorA)

Example 2 with IPanelButton

use of betterquesting.api2.client.gui.controls.IPanelButton in project BetterQuesting by Funwayguy.

the class GuiHome method onButtonPress.

private void onButtonPress(PEventButton event) {
    Minecraft mc = Minecraft.getMinecraft();
    IPanelButton btn = event.getButton();
    if (// Exit
    btn.getButtonID() == 0) {
        mc.displayGuiScreen(this.parent);
    } else if (// Quests
    btn.getButtonID() == 1) {
        mc.displayGuiScreen(new GuiQuestLines(this));
    } else if (// Party
    btn.getButtonID() == 2) {
        IParty party = PartyManager.INSTANCE.getUserParty(QuestingAPI.getQuestingUUID(mc.player));
        if (party != null) {
            mc.displayGuiScreen(new GuiManageParty(this, party));
        } else {
            mc.displayGuiScreen(new GuiNoParty(this));
        }
    } else if (// Theme
    btn.getButtonID() == 3) {
        mc.displayGuiScreen(new GuiThemes(this));
    } else if (// Editor
    btn.getButtonID() == 4) {
        mc.displayGuiScreen(new GuiJsonEditor(this, QuestSettings.INSTANCE.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG), null, (NBTTagCompound value) -> {
            QuestSettings.INSTANCE.readFromNBT(value, EnumSaveType.CONFIG);
            PacketSender.INSTANCE.sendToServer(QuestSettings.INSTANCE.getSyncPacket());
        }));
    }
}
Also used : IPanelButton(betterquesting.api2.client.gui.controls.IPanelButton) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IParty(betterquesting.api.questing.party.IParty) Minecraft(net.minecraft.client.Minecraft) GuiJsonEditor(betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor) GuiManageParty(betterquesting.client.gui.party.GuiManageParty) GuiNoParty(betterquesting.client.gui.party.GuiNoParty)

Example 3 with IPanelButton

use of betterquesting.api2.client.gui.controls.IPanelButton in project BetterQuesting by Funwayguy.

the class GuiQuest method onButtonPress.

private void onButtonPress(PEventButton event) {
    IPanelButton btn = event.getButton();
    if (// Exit
    btn.getButtonID() == 0) {
        mc.displayGuiScreen(this.parent);
    } else if (// Edit
    btn.getButtonID() == 1) {
        mc.displayGuiScreen(new GuiQuestEditor(this, quest));
    } else if (// Reward previous
    btn.getButtonID() == 2) {
        rewardIndex = MathHelper.clamp(rewardIndex - 1, 0, quest.getRewards().size() - 1);
        refreshRewardPanel();
    } else if (// Reward next
    btn.getButtonID() == 3) {
        rewardIndex = MathHelper.clamp(rewardIndex + 1, 0, quest.getRewards().size() - 1);
        refreshRewardPanel();
    } else if (// Task previous
    btn.getButtonID() == 4) {
        taskIndex = MathHelper.clamp(taskIndex - 1, 0, quest.getTasks().size() - 1);
        refreshTaskPanel();
    } else if (// Task next
    btn.getButtonID() == 5) {
        taskIndex = MathHelper.clamp(taskIndex + 1, 0, quest.getTasks().size() - 1);
        refreshTaskPanel();
    } else if (// Reward claim
    btn.getButtonID() == 6) {
        NBTTagCompound tags = new NBTTagCompound();
        tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(quest));
        PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.CLAIM.GetLocation(), tags));
    } else if (// Task detect/submit
    btn.getButtonID() == 7) {
        NBTTagCompound tags = new NBTTagCompound();
        tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(quest));
        PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.DETECT.GetLocation(), tags));
    }
}
Also used : IPanelButton(betterquesting.api2.client.gui.controls.IPanelButton) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GuiQuestEditor(betterquesting.client.gui.editors.GuiQuestEditor) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 4 with IPanelButton

use of betterquesting.api2.client.gui.controls.IPanelButton in project BetterQuesting by Funwayguy.

the class GuiThemes method onButtonPress.

@SuppressWarnings("unchecked")
private void onButtonPress(PEventButton event) {
    Minecraft mc = Minecraft.getMinecraft();
    IPanelButton btn = event.getButton();
    if (// Exit
    btn.getButtonID() == 0) {
        mc.displayGuiScreen(this.parent);
    } else if (btn.getButtonID() == 1 && btn instanceof PanelButtonStorage) {
        ResourceLocation res = ((PanelButtonStorage<ResourceLocation>) btn).getStoredValue();
        float scroll = scrollPanel.readValue();
        betterquesting.client.themes.ThemeRegistry.INSTANCE.setCurrentTheme(res);
        // ThemeRegistry.INSTANCE.setTheme(res);
        this.initGui();
        scrollPanel.writeValue(scroll);
    }
}
Also used : IPanelButton(betterquesting.api2.client.gui.controls.IPanelButton) ResourceLocation(net.minecraft.util.ResourceLocation) PanelButtonStorage(betterquesting.api2.client.gui.controls.PanelButtonStorage) Minecraft(net.minecraft.client.Minecraft)

Aggregations

IPanelButton (betterquesting.api2.client.gui.controls.IPanelButton)4 Minecraft (net.minecraft.client.Minecraft)3 PanelButtonStorage (betterquesting.api2.client.gui.controls.PanelButtonStorage)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 QuestingPacket (betterquesting.api.network.QuestingPacket)1 IQuest (betterquesting.api.questing.IQuest)1 IQuestLine (betterquesting.api.questing.IQuestLine)1 IParty (betterquesting.api.questing.party.IParty)1 GuiQuestEditor (betterquesting.client.gui.editors.GuiQuestEditor)1 GuiQuestLineEditorA (betterquesting.client.gui.editors.GuiQuestLineEditorA)1 GuiJsonEditor (betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor)1 GuiManageParty (betterquesting.client.gui.party.GuiManageParty)1 GuiNoParty (betterquesting.client.gui.party.GuiNoParty)1 ResourceLocation (net.minecraft.util.ResourceLocation)1