use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.
the class GuiRewardEditor method SendChanges.
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", QuestDatabase.INSTANCE.getKey(quest));
tags.setTag("data", base);
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tags));
}
use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.
the class GuiTaskEditDefault method SendChanges.
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", qID);
tags.setTag("data", base);
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tags));
}
use of betterquesting.api.network.QuestingPacket 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));
}
}
use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.
the class ToolboxToolNew method onMouseClick.
@Override
public void onMouseClick(int mx, int my, int click) {
if (click != 0) {
return;
}
int snap = ToolboxGuiMain.getSnapValue();
int modX = ((mx % snap) + snap) % snap;
int modY = ((my % snap) + snap) % snap;
mx -= modX;
my -= modY;
// Pre-sync
IQuestLine qLine = gui.getQuestLine().getQuestLine();
IQuest quest = new QuestInstance();
int qID = QuestDatabase.INSTANCE.nextKey();
int lID = QuestLineDatabase.INSTANCE.getKey(qLine);
QuestLineEntry qe = new QuestLineEntry(mx, my, 24);
qLine.add(qe, qID);
// Sync Quest
NBTTagCompound tag1 = new NBTTagCompound();
NBTTagCompound base1 = new NBTTagCompound();
base1.setTag("config", quest.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
tag1.setTag("data", base1);
tag1.setInteger("action", EnumPacketAction.ADD.ordinal());
tag1.setInteger("questID", qID);
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.QUEST_EDIT.GetLocation(), tag1));
// Sync Line
NBTTagCompound tag2 = new NBTTagCompound();
NBTTagCompound base2 = new NBTTagCompound();
base2.setTag("line", qLine.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG));
tag2.setTag("data", base2);
tag2.setInteger("action", EnumPacketAction.EDIT.ordinal());
tag2.setInteger("lineID", lID);
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.LINE_EDIT.GetLocation(), tag2));
}
use of betterquesting.api.network.QuestingPacket 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));
}
}
Aggregations