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);
}
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);
}
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);
}
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);
}
}
}
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();
}
}
}
Aggregations