use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.
the class TileSubmitStation method SyncTile.
/**
* Ignores parameter on client side (uses own data instead)
*/
public void SyncTile(NBTTagCompound data) {
if (!world.isRemote) {
this.readFromNBT(data);
this.markDirty();
world.getMinecraftServer().getPlayerList().sendToAllNearExcept(null, pos.getX(), pos.getY(), pos.getZ(), 128, world.provider.getDimension(), getUpdatePacket());
} else {
NBTTagCompound payload = new NBTTagCompound();
NBTTagCompound tileData = new NBTTagCompound();
this.writeToNBT(tileData);
payload.setTag("tile", tileData);
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.EDIT_STATION.GetLocation(), payload));
}
}
use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.
the class GuiPartyInvite method actionPerformed.
@Override
public void actionPerformed(GuiButton button) {
super.actionPerformed(button);
if (button.id == 1) {
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("action", EnumPacketAction.INVITE.ordinal());
tags.setInteger("partyID", PartyManager.INSTANCE.getKey(party));
tags.setString("target", txtManual.getText());
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.PARTY_EDIT.GetLocation(), tags));
} else if (button.id > 1) {
// Button index
int n1 = button.id - 2;
// Column listing (0 = line)
int n2 = n1 / (maxRows * 3);
// Format index
int n3 = n1 % (maxRows * 3) + listScroll;
if (n2 == 0) {
if (n3 >= 0 && n3 < playerList.size()) {
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("action", EnumPacketAction.INVITE.ordinal());
tags.setInteger("partyID", PartyManager.INSTANCE.getKey(party));
tags.setString("target", button.displayString);
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.PARTY_EDIT.GetLocation(), tags));
}
}
}
}
use of betterquesting.api.network.QuestingPacket 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));
}
}
use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.
the class GuiQuest method onButtonPress.
private void onButtonPress(PEventButton event) {
IPanelButton btn = event.getButton();
if (// Exit
btn.getButtonID() == 0) {
mc.displayGuiScreen(this.parent);
} else if (// Edit
btn.getButtonID() == 1) {
mc.displayGuiScreen(new GuiQuestEditor(this, quest));
} else if (// Reward previous
btn.getButtonID() == 2) {
rewardIndex = MathHelper.clamp(rewardIndex - 1, 0, quest.getRewards().size() - 1);
refreshRewardPanel();
} else if (// Reward next
btn.getButtonID() == 3) {
rewardIndex = MathHelper.clamp(rewardIndex + 1, 0, quest.getRewards().size() - 1);
refreshRewardPanel();
} else if (// Task previous
btn.getButtonID() == 4) {
taskIndex = MathHelper.clamp(taskIndex - 1, 0, quest.getTasks().size() - 1);
refreshTaskPanel();
} else if (// Task next
btn.getButtonID() == 5) {
taskIndex = MathHelper.clamp(taskIndex + 1, 0, quest.getTasks().size() - 1);
refreshTaskPanel();
} else if (// Reward claim
btn.getButtonID() == 6) {
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(quest));
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.CLAIM.GetLocation(), tags));
} else if (// Task detect/submit
btn.getButtonID() == 7) {
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(quest));
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.DETECT.GetLocation(), tags));
}
}
use of betterquesting.api.network.QuestingPacket in project BetterQuesting by Funwayguy.
the class GuiRewardEditDefault 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));
}
Aggregations