Search in sources :

Example 21 with QuestingPacket

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));
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 22 with QuestingPacket

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));
            }
        }
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 23 with QuestingPacket

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));
    }
}
Also used : GuiButtonQuestInstance(betterquesting.api.client.gui.controls.GuiButtonQuestInstance) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 24 with QuestingPacket

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));
    }
}
Also used : IPanelButton(betterquesting.api2.client.gui.controls.IPanelButton) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GuiQuestEditor(betterquesting.client.gui.editors.GuiQuestEditor) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 25 with QuestingPacket

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