Search in sources :

Example 31 with QuestingPacket

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

the class ToolboxToolReset 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("status", false);
        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 32 with QuestingPacket

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

the class QuestDatabase method getSyncPacket.

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

Example 33 with QuestingPacket

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

the class QuestInstance method postNotice.

public void postNotice(EntityPlayer player, String mainTxt, String subTxt, String sound, BigItemStack icon) {
    NBTTagCompound tags = new NBTTagCompound();
    tags.setString("Main", mainTxt);
    tags.setString("Sub", subTxt);
    tags.setString("Sound", sound);
    tags.setTag("Icon", icon.writeToNBT(new NBTTagCompound()));
    QuestingPacket payload = new QuestingPacket(PacketTypeNative.NOTIFICATION.GetLocation(), tags);
    if (qInfo.getProperty(NativeProps.GLOBAL)) {
        PacketSender.INSTANCE.sendToAll(payload);
    } else if (player instanceof EntityPlayerMP) {
        List<EntityPlayerMP> tarList = getPartyPlayers((EntityPlayerMP) player);
        for (EntityPlayerMP p : tarList) {
            PacketSender.INSTANCE.sendToPlayer(payload, p);
        }
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ArrayList(java.util.ArrayList) NBTTagList(net.minecraft.nbt.NBTTagList) List(java.util.List) QuestingPacket(betterquesting.api.network.QuestingPacket)

Example 34 with QuestingPacket

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

the class QuestLine method getSyncPacket.

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

Example 35 with QuestingPacket

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

the class QuestLineDatabase method getSyncPacket.

@Override
public QuestingPacket getSyncPacket() {
    NBTTagCompound tags = new NBTTagCompound();
    tags.setTag("data", writeToNBT(new NBTTagList(), EnumSaveType.CONFIG));
    return new QuestingPacket(PacketTypeNative.LINE_DATABASE.GetLocation(), tags);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) 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