Search in sources :

Example 1 with PacketPlayOutEntityEquipment

use of net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= Setting.PACKET_UPDATE_DELAY.asInt())
        return;
    updateCounter = 0;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[navigating ? EnumItemSlot.values().length : EnumItemSlot.values().length + 1];
    if (!navigating) {
        packets[5] = new PacketPlayOutEntityHeadRotation(this, (byte) MathHelper.d(NMSImpl.getHeadYaw(this) * 256.0F / 360.0F));
    }
    int i = 0;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
    }
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : Packet(net.minecraft.server.v1_10_R1.Packet) EnumItemSlot(net.minecraft.server.v1_10_R1.EnumItemSlot) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_10_R1.PacketPlayOutEntityHeadRotation) PacketPlayOutEntityEquipment(net.minecraft.server.v1_10_R1.PacketPlayOutEntityEquipment) Location(org.bukkit.Location)

Example 2 with PacketPlayOutEntityEquipment

use of net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= Setting.PACKET_UPDATE_DELAY.asInt())
        return;
    updateCounter = 0;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[navigating ? EnumItemSlot.values().length : EnumItemSlot.values().length + 1];
    if (!navigating) {
        packets[5] = new PacketPlayOutEntityHeadRotation(this, (byte) MathHelper.d(NMSImpl.getHeadYaw(this) * 256.0F / 360.0F));
    }
    int i = 0;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
    }
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : Packet(net.minecraft.server.v1_11_R1.Packet) EnumItemSlot(net.minecraft.server.v1_11_R1.EnumItemSlot) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_11_R1.PacketPlayOutEntityHeadRotation) PacketPlayOutEntityEquipment(net.minecraft.server.v1_11_R1.PacketPlayOutEntityEquipment) Location(org.bukkit.Location)

Example 3 with PacketPlayOutEntityEquipment

use of net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= Setting.PACKET_UPDATE_DELAY.asInt())
        return;
    updateCounter = 0;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[navigating ? this.inventory.armor.length : this.inventory.armor.length + 1];
    if (!navigating) {
        packets[this.inventory.armor.length] = new PacketPlayOutEntityHeadRotation(this, (byte) MathHelper.d(NMSImpl.getHeadYaw(this) * 256.0F / 360.0F));
    }
    for (int i = 0; i < this.inventory.armor.length; i++) {
        packets[i] = new PacketPlayOutEntityEquipment(getId(), i, getEquipment(i));
    }
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : Packet(net.minecraft.server.v1_8_R3.Packet) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation) PacketPlayOutEntityEquipment(net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment) Location(org.bukkit.Location)

Example 4 with PacketPlayOutEntityEquipment

use of net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment in project Citizens2 by CitizensDev.

the class EntityHumanNPC method updatePackets.

private void updatePackets(boolean navigating) {
    if (updateCounter++ <= Setting.PACKET_UPDATE_DELAY.asInt())
        return;
    updateCounter = 0;
    Location current = getBukkitEntity().getLocation(packetLocationCache);
    Packet<?>[] packets = new Packet[navigating ? EnumItemSlot.values().length : EnumItemSlot.values().length + 1];
    if (!navigating) {
        packets[5] = new PacketPlayOutEntityHeadRotation(this, (byte) MathHelper.d(NMSImpl.getHeadYaw(this) * 256.0F / 360.0F));
    }
    int i = 0;
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        packets[i++] = new PacketPlayOutEntityEquipment(getId(), slot, getEquipment(slot));
    }
    NMSImpl.sendPacketsNearby(getBukkitEntity(), current, packets);
}
Also used : Packet(net.minecraft.server.v1_12_R1.Packet) EnumItemSlot(net.minecraft.server.v1_12_R1.EnumItemSlot) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation) PacketPlayOutEntityEquipment(net.minecraft.server.v1_12_R1.PacketPlayOutEntityEquipment) Location(org.bukkit.Location)

Aggregations

Location (org.bukkit.Location)4 EnumItemSlot (net.minecraft.server.v1_10_R1.EnumItemSlot)1 Packet (net.minecraft.server.v1_10_R1.Packet)1 PacketPlayOutEntityEquipment (net.minecraft.server.v1_10_R1.PacketPlayOutEntityEquipment)1 PacketPlayOutEntityHeadRotation (net.minecraft.server.v1_10_R1.PacketPlayOutEntityHeadRotation)1 EnumItemSlot (net.minecraft.server.v1_11_R1.EnumItemSlot)1 Packet (net.minecraft.server.v1_11_R1.Packet)1 PacketPlayOutEntityEquipment (net.minecraft.server.v1_11_R1.PacketPlayOutEntityEquipment)1 PacketPlayOutEntityHeadRotation (net.minecraft.server.v1_11_R1.PacketPlayOutEntityHeadRotation)1 EnumItemSlot (net.minecraft.server.v1_12_R1.EnumItemSlot)1 Packet (net.minecraft.server.v1_12_R1.Packet)1 PacketPlayOutEntityEquipment (net.minecraft.server.v1_12_R1.PacketPlayOutEntityEquipment)1 PacketPlayOutEntityHeadRotation (net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation)1 Packet (net.minecraft.server.v1_8_R3.Packet)1 PacketPlayOutEntityEquipment (net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment)1 PacketPlayOutEntityHeadRotation (net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation)1