Search in sources :

Example 6 with QuestingPacket

use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.

the class GuiPrerequisiteEditor method createQuest.

public void createQuest() {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setInteger("action", EnumPacketAction.ADD.ordinal());
    PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tag));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 7 with QuestingPacket

use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.

the class GuiQuestEditor method SendChanges.

// If the changes are approved by the server, it will be broadcast to all players including the editor
public void SendChanges() {
    NBTTagCompound base = new NBTTagCompound();
    base.setTag("config", quest.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
    base.setTag("progress", quest.writeToNBT(new NBTTagCompound(), EnumSaveType.PROGRESS));
    NBTTagCompound tags = new NBTTagCompound();
    // Action: Update data
    tags.setInteger("action", EnumPacketAction.EDIT.ordinal());
    tags.setInteger("questID", id);
    tags.setTag("data", base);
    PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tags));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 8 with QuestingPacket

use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.

the class GuiQuestLineEditorA method DeleteQuest.

public void DeleteQuest(int id) {
    NBTTagCompound tags = new NBTTagCompound();
    tags.setInteger("action", 1);
    tags.setInteger("questID", id);
    PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tags));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 9 with QuestingPacket

use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.

the class GuiQuestLineEditorA method SendChanges.

public void SendChanges(EnumPacketAction action, int lineID, int order) {
    IQuestLine questLine = QuestLineDatabase.INSTANCE.getValue(lineID);
    if (action == null) {
        return;
    }
    NBTTagCompound tags = new NBTTagCompound();
    if (action == EnumPacketAction.EDIT && questLine != null) {
        NBTTagCompound base = new NBTTagCompound();
        base.setTag("line", questLine.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
        tags.setTag("data", base);
    }
    tags.setInteger("lineID", questLine == null ? -1 : QuestLineDatabase.INSTANCE.getKey(questLine));
    tags.setInteger("order", order);
    tags.setInteger("action", action.ordinal());
    PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.LINE_EDIT.GetLocation(), tags));
}
Also used : IQuestLine(betterquesting.api.questing.IQuestLine) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 10 with QuestingPacket

use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.

the class GuiQuestLineEditorB method SendChanges.

public void SendChanges(EnumPacketAction action, int lineID) {
    if (action == null) {
        return;
    }
    NBTTagCompound tags = new NBTTagCompound();
    if (action == EnumPacketAction.EDIT && line != null) {
        NBTTagCompound base = new NBTTagCompound();
        base.setTag("line", line.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
        tags.setTag("data", base);
    }
    tags.setInteger("action", action.ordinal());
    tags.setInteger("lineID", QuestLineDatabase.INSTANCE.getKey(line));
    PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.LINE_EDIT.GetLocation(), tags));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Aggregations

QuestingPacket (betterquesting.api.network.QuestingPacket)40 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)40 GuiButtonQuestInstance (betterquesting.api.client.gui.controls.GuiButtonQuestInstance)6 IQuestLine (betterquesting.api.questing.IQuestLine)6 NBTTagList (net.minecraft.nbt.NBTTagList)6 IQuest (betterquesting.api.questing.IQuest)4 IQuestLineEntry (betterquesting.api.questing.IQuestLineEntry)3 QuestLineEntry (betterquesting.questing.QuestLineEntry)3 GuiQuest (betterquesting.client.gui2.GuiQuest)2 QuestInstance (betterquesting.questing.QuestInstance)2 IQuestDatabase (betterquesting.api.questing.IQuestDatabase)1 IQuestLineDatabase (betterquesting.api.questing.IQuestLineDatabase)1 IPanelButton (betterquesting.api2.client.gui.controls.IPanelButton)1 GuiQuestEditor (betterquesting.client.gui.editors.GuiQuestEditor)1 ImportedQuestLines (betterquesting.client.importers.ImportedQuestLines)1 ImportedQuests (betterquesting.client.importers.ImportedQuests)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1