Search in sources :

Example 1 with QuestingPacket

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

the class QuestInstance method getSyncPacket.

@Override
public QuestingPacket getSyncPacket() {
    NBTTagCompound tags = new NBTTagCompound();
    NBTTagCompound base = new NBTTagCompound();
    base.setTag("config", writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
    base.setTag("progress", writeToNBT(new NBTTagCompound(), EnumSaveType.PROGRESS));
    tags.setTag("data", base);
    tags.setInteger("questID", parentDB.getKey(this));
    return new QuestingPacket(PacketTypeNative.QUEST_SYNC.GetLocation(), tags);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 2 with QuestingPacket

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

the class PartyInstance method getSyncPacket.

@Override
public QuestingPacket getSyncPacket() {
    NBTTagCompound tags = new NBTTagCompound();
    tags.setTag("data", writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
    tags.setInteger("partyID", PartyManager.INSTANCE.getKey(this));
    return new QuestingPacket(PacketTypeNative.PARTY_SYNC.GetLocation(), tags);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 3 with QuestingPacket

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

the class LifeDatabase method getSyncPacket.

@Override
public QuestingPacket getSyncPacket() {
    NBTTagCompound tags = new NBTTagCompound();
    NBTTagCompound base = new NBTTagCompound();
    base.setTag("config", writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
    base.setTag("lives", writeToNBT(new NBTTagCompound(), EnumSaveType.PROGRESS));
    tags.setTag("data", base);
    return new QuestingPacket(PacketTypeNative.LIFE_DATABASE.GetLocation(), tags);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 4 with QuestingPacket

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

the class GuiImporters method setValues.

@Override
public void setValues(File[] files) {
    if (selected != null) {
        IQuestDatabase questDB = new ImportedQuests();
        IQuestLineDatabase lineDB = new ImportedQuestLines();
        selected.loadFiles(questDB, lineDB, files);
        if (questDB.size() > 0 || lineDB.size() > 0) {
            NBTTagCompound jsonBase = new NBTTagCompound();
            jsonBase.setTag("quests", questDB.writeToNBT(new NBTTagList(), EnumSaveType.CONFIG));
            jsonBase.setTag("lines", lineDB.writeToNBT(new NBTTagList(), EnumSaveType.CONFIG));
            NBTTagCompound tag = new NBTTagCompound();
            tag.setTag("data", jsonBase);
            PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.IMPORT.GetLocation(), tag));
            mc.displayGuiScreen(parent);
        }
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) IQuestDatabase(betterquesting.api.questing.IQuestDatabase) IQuestLineDatabase(betterquesting.api.questing.IQuestLineDatabase) ImportedQuestLines(betterquesting.client.importers.ImportedQuestLines) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ImportedQuests(betterquesting.client.importers.ImportedQuests) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 5 with QuestingPacket

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

the class GuiPrerequisiteEditor method actionPerformed.

@Override
public void actionPerformed(GuiButton button) {
    super.actionPerformed(button);
    if (button.id == 1) {
        createQuest();
    } else if (button.id > 1) {
        int column = button.id & 7;
        int id = (button.id >> 3) - 2;
        IQuest q = QuestDatabase.INSTANCE.getValue(id);
        if (id < 0 || q == null) {
            // Invalid quest ID
            return;
        } else if (// Edit quest
        column == 0 || column == 3) {
            mc.displayGuiScreen(new GuiQuest(this, id));
        } else if (// Remove quest
        column == 1) {
            quest.getPrerequisites().remove(q);
            SendChanges();
        } else if (// Delete quest
        column == 4) {
            NBTTagCompound tags = new NBTTagCompound();
            // Delete quest
            tags.setInteger("action", EnumPacketAction.REMOVE.ordinal());
            tags.setInteger("questID", id);
            PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tags));
        } else if (// Add quest
        column == 2) {
            quest.getPrerequisites().add(q);
            SendChanges();
        }
    }
}
Also used : GuiQuest(betterquesting.client.gui2.GuiQuest) IQuest(betterquesting.api.questing.IQuest) 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