Search in sources :

Example 1 with EnumItemSlot

use of net.minecraft.server.v1_10_R1.EnumItemSlot 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 EnumItemSlot

use of net.minecraft.server.v1_10_R1.EnumItemSlot 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 EnumItemSlot

use of net.minecraft.server.v1_10_R1.EnumItemSlot 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)3 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