Search in sources :

Example 1 with GuiQuestEditor

use of betterquesting.client.gui.editors.GuiQuestEditor 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)

Aggregations

QuestingPacket (betterquesting.api.network.QuestingPacket)1 IPanelButton (betterquesting.api2.client.gui.controls.IPanelButton)1 GuiQuestEditor (betterquesting.client.gui.editors.GuiQuestEditor)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1