Search in sources :

Example 6 with GuiButtonQuestInstance

use of betterquesting.api.client.gui.controls.GuiButtonQuestInstance in project BetterQuesting by Funwayguy.

the class ToolboxToolComplete method onMouseClick.

@Override
public void onMouseClick(int mx, int my, int click) {
    if (click != 0) {
        return;
    }
    GuiButtonQuestInstance btn = gui.getQuestLine().getButtonAt(mx, my);
    if (btn != null) {
        NBTTagCompound tags = new NBTTagCompound();
        // Complete quest
        tags.setInteger("action", EnumPacketAction.SET.ordinal());
        tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(btn.getQuest()));
        tags.setBoolean("state", true);
        PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tags));
    }
}
Also used : GuiButtonQuestInstance(betterquesting.api.client.gui.controls.GuiButtonQuestInstance) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 7 with GuiButtonQuestInstance

use of betterquesting.api.client.gui.controls.GuiButtonQuestInstance in project BetterQuesting by Funwayguy.

the class ToolboxToolDelete method onMouseClick.

@Override
public void onMouseClick(int mx, int my, int click) {
    if (click != 0) {
        return;
    }
    GuiButtonQuestInstance btn = gui.getQuestLine().getButtonAt(mx, my);
    if (btn != null) {
        NBTTagCompound tags = new NBTTagCompound();
        // Delete quest
        tags.setInteger("action", EnumPacketAction.REMOVE.ordinal());
        tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(btn.getQuest()));
        PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tags));
    }
}
Also used : GuiButtonQuestInstance(betterquesting.api.client.gui.controls.GuiButtonQuestInstance) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 8 with GuiButtonQuestInstance

use of betterquesting.api.client.gui.controls.GuiButtonQuestInstance in project BetterQuesting by Funwayguy.

the class ToolboxToolIcon method onMouseClick.

@Override
public void onMouseClick(int mx, int my, int click) {
    if (click != 0) {
        return;
    }
    GuiButtonQuestInstance btn = gui.getQuestLine().getButtonAt(mx, my);
    if (btn != null) {
        Minecraft mc = Minecraft.getMinecraft();
        btn.playPressSound(mc.getSoundHandler());
        mc.displayGuiScreen(new GuiToolIconProxy(mc.currentScreen, btn.getQuest()));
    }
}
Also used : GuiButtonQuestInstance(betterquesting.api.client.gui.controls.GuiButtonQuestInstance) GuiToolIconProxy(betterquesting.client.toolbox.GuiToolIconProxy) Minecraft(net.minecraft.client.Minecraft)

Example 9 with GuiButtonQuestInstance

use of betterquesting.api.client.gui.controls.GuiButtonQuestInstance in project BetterQuesting by Funwayguy.

the class ToolboxToolOpen method onMouseClick.

@Override
public void onMouseClick(int mx, int my, int click) {
    if (click != 0) {
        return;
    }
    GuiButtonQuestInstance btn = gui.getQuestLine().getButtonAt(mx, my);
    if (btn != null) {
        int qID = QuestDatabase.INSTANCE.getKey(btn.getQuest());
        Minecraft mc = Minecraft.getMinecraft();
        btn.playPressSound(mc.getSoundHandler());
        mc.displayGuiScreen(new GuiQuest(mc.currentScreen, qID));
    }
}
Also used : GuiButtonQuestInstance(betterquesting.api.client.gui.controls.GuiButtonQuestInstance) GuiQuest(betterquesting.client.gui2.GuiQuest) Minecraft(net.minecraft.client.Minecraft)

Example 10 with GuiButtonQuestInstance

use of betterquesting.api.client.gui.controls.GuiButtonQuestInstance in project BetterQuesting by Funwayguy.

the class ToolboxToolRemove method onMouseClick.

@Override
public void onMouseClick(int mx, int my, int click) {
    if (click != 0) {
        return;
    }
    IQuestLine line = gui.getQuestLine().getQuestLine();
    GuiButtonQuestInstance btn = gui.getQuestLine().getButtonAt(mx, my);
    if (line != null && btn != null) {
        int qID = QuestDatabase.INSTANCE.getKey(btn.getQuest());
        line.removeKey(qID);
        NBTTagCompound tags = new NBTTagCompound();
        tags.setInteger("action", EnumPacketAction.EDIT.ordinal());
        NBTTagCompound base = new NBTTagCompound();
        base.setTag("line", line.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
        tags.setTag("data", base);
        tags.setInteger("lineID", QuestLineDatabase.INSTANCE.getKey(line));
        PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.LINE_EDIT.GetLocation(), tags));
    }
}
Also used : GuiButtonQuestInstance(betterquesting.api.client.gui.controls.GuiButtonQuestInstance) IQuestLine(betterquesting.api.questing.IQuestLine) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Aggregations

GuiButtonQuestInstance (betterquesting.api.client.gui.controls.GuiButtonQuestInstance)11 QuestingPacket (betterquesting.api.network.QuestingPacket)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 IQuest (betterquesting.api.questing.IQuest)4 Minecraft (net.minecraft.client.Minecraft)3 IQuestLine (betterquesting.api.questing.IQuestLine)2 QuestInstance (betterquesting.questing.QuestInstance)2 IQuestLineEntry (betterquesting.api.questing.IQuestLineEntry)1 GuiRectangle (betterquesting.api2.client.gui.misc.GuiRectangle)1 GuiQuest (betterquesting.client.gui2.GuiQuest)1 GuiToolIconProxy (betterquesting.client.toolbox.GuiToolIconProxy)1 QuestLineEntry (betterquesting.questing.QuestLineEntry)1