Search in sources :

Example 36 with Packet

use of net.minecraft.server.v1_14_R1.Packet in project Citizens2 by CitizensDev.

the class PlayerAnimationImpl method playDefaultAnimation.

protected static void playDefaultAnimation(EntityPlayer player, int radius, int code) {
    PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, code);
    sendPacketNearby(packet, player, radius);
}
Also used : PacketPlayOutAnimation(net.minecraft.server.v1_14_R1.PacketPlayOutAnimation)

Example 37 with Packet

use of net.minecraft.server.v1_14_R1.Packet in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= npc.data().<Integer>get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt()))
        return;
    updateCounter = 0;
    boolean itemChanged = false;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        ItemStack equipment = getEquipment(slot);
        ItemStack cache = equipmentCache.get(slot);
        if (!(cache == null && equipment == null) && (cache == null ^ equipment == null || !ItemStack.equals(cache, equipment))) {
            itemChanged = true;
        }
        equipmentCache.put(slot, equipment);
    }
    if (!itemChanged)
        return;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[EnumItemSlot.values().length];
    int i = 0;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
    }
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : EnumItemSlot(net.minecraft.server.v1_14_R1.EnumItemSlot) Packet(net.minecraft.server.v1_14_R1.Packet) ItemStack(net.minecraft.server.v1_14_R1.ItemStack) PacketPlayOutEntityEquipment(net.minecraft.server.v1_14_R1.PacketPlayOutEntityEquipment) Location(org.bukkit.Location)

Example 38 with Packet

use of net.minecraft.server.v1_14_R1.Packet in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= npc.data().<Integer>get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt()))
        return;
    updateCounter = 0;
    boolean itemChanged = false;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        ItemStack equipment = getEquipment(slot);
        ItemStack cache = equipmentCache.get(slot);
        if (!(cache == null && equipment == null) && (cache == null ^ equipment == null || !ItemStack.equals(cache, equipment))) {
            itemChanged = true;
        }
        equipmentCache.put(slot, equipment);
    }
    if (!itemChanged)
        return;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[EnumItemSlot.values().length];
    int i = 0;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
    }
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : EnumItemSlot(net.minecraft.server.v1_15_R1.EnumItemSlot) Packet(net.minecraft.server.v1_15_R1.Packet) ItemStack(net.minecraft.server.v1_15_R1.ItemStack) PacketPlayOutEntityEquipment(net.minecraft.server.v1_15_R1.PacketPlayOutEntityEquipment) Location(org.bukkit.Location)

Example 39 with Packet

use of net.minecraft.server.v1_14_R1.Packet in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= npc.data().<Integer>get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt()))
        return;
    updateCounter = 0;
    boolean itemChanged = false;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        ItemStack equipment = getEquipment(slot);
        ItemStack cache = equipmentCache.get(slot);
        if (!(cache == null && equipment == null) && (cache == null ^ equipment == null || !ItemStack.equals(cache, equipment))) {
            itemChanged = true;
        }
        equipmentCache.put(slot, equipment);
    }
    if (!itemChanged)
        return;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[1];
    List<Pair<EnumItemSlot, ItemStack>> vals = Lists.newArrayList();
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        vals.add(new Pair<EnumItemSlot, ItemStack>(slot, getEquipment(slot)));
    }
    packets[0] = new PacketPlayOutEntityEquipment(getId(), vals);
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : EnumItemSlot(net.minecraft.server.v1_16_R3.EnumItemSlot) Packet(net.minecraft.server.v1_16_R3.Packet) ItemStack(net.minecraft.server.v1_16_R3.ItemStack) PacketPlayOutEntityEquipment(net.minecraft.server.v1_16_R3.PacketPlayOutEntityEquipment) Location(org.bukkit.Location) Pair(com.mojang.datafixers.util.Pair)

Example 40 with Packet

use of net.minecraft.server.v1_14_R1.Packet in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= npc.data().<Integer>get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt()))
        return;
    updateCounter = 0;
    boolean itemChanged = false;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        ItemStack equipment = getEquipment(slot);
        ItemStack cache = equipmentCache.get(slot);
        if (!(cache == null && equipment == null) && (cache == null ^ equipment == null || !ItemStack.equals(cache, equipment))) {
            itemChanged = true;
        }
        equipmentCache.put(slot, equipment);
    }
    if (!itemChanged)
        return;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[EnumItemSlot.values().length];
    int i = 0;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
    }
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : EnumItemSlot(net.minecraft.server.v1_12_R1.EnumItemSlot) Packet(net.minecraft.server.v1_12_R1.Packet) ItemStack(net.minecraft.server.v1_12_R1.ItemStack) PacketPlayOutEntityEquipment(net.minecraft.server.v1_12_R1.PacketPlayOutEntityEquipment) Location(org.bukkit.Location)

Aggregations

GameProfile (com.mojang.authlib.GameProfile)19 Location (org.bukkit.Location)10 CraftPlayer (org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer)10 SkinTexture (net.dzikoysk.funnyguilds.nms.api.playerlist.SkinTexture)9 Player (org.bukkit.entity.Player)9 Packet (com.yahoo.fs4.Packet)4 Packet (net.minecraft.server.v1_13_R2.Packet)4 IChatBaseComponent (net.minecraft.server.v1_14_R1.IChatBaseComponent)4 BasicPacket (com.yahoo.fs4.BasicPacket)3 ChannelTimeoutException (com.yahoo.fs4.ChannelTimeoutException)3 QueryPacket (com.yahoo.fs4.QueryPacket)3 Packet (ejip123.Packet)3 Packet (net.minecraft.server.v1_11_R1.Packet)3 Packet (net.minecraft.server.v1_12_R1.Packet)3 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_14_R1.PacketPlayOutPlayerListHeaderFooter)3 Packet (net.minecraft.server.v1_15_R1.Packet)3 Packet (net.minecraft.server.v1_16_R3.Packet)3 Packet (net.minecraft.server.v1_8_R3.Packet)3 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)3 GetDocSumsPacket (com.yahoo.fs4.GetDocSumsPacket)2