Search in sources :

Example 11 with PacketPlayOutSpawnEntity

use of net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity in project MechanicsMain by WeaponMechanics.

the class FakeEntity_1_10_R1 method show.

@Override
public void show(@NotNull Player player) {
    PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
    if (connections.contains(connection))
        throw new IllegalArgumentException();
    connection.sendPacket(type.isAlive() ? new PacketPlayOutSpawnEntityLiving((EntityLiving) entity) : new PacketPlayOutSpawnEntity(entity, type == EntityType.FALLING_BLOCK ? Block.getCombinedId(block) : 0));
    connection.sendPacket(new PacketPlayOutEntityMetadata(cache, entity.getDataWatcher(), true));
    connection.sendPacket(new PacketPlayOutEntityLook(cache, convertYaw(getYaw()), convertPitch(getPitch()), false));
    connection.sendPacket(new PacketPlayOutEntityVelocity(cache, motion.getX(), motion.getY(), motion.getZ()));
    connection.sendPacket(new PacketPlayOutEntityHeadRotation(entity, convertYaw(getYaw())));
    PacketPlayOutEntityEquipment[] equipment = getEquipmentPacket();
    if (equipment != null) {
        for (PacketPlayOutEntityEquipment packet : equipment) {
            connection.sendPacket(packet);
        }
    }
    // Inject the player's packet connection into this listener, so we can
    // show the player position/velocity/rotation changes
    connections.add(connection);
}
Also used : PacketPlayOutEntityLook(net.minecraft.server.v1_10_R1.PacketPlayOutEntity.PacketPlayOutEntityLook)

Aggregations

FakeEntity (net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity)9 PacketPlayOutEntityLook (net.minecraft.server.v1_10_R1.PacketPlayOutEntity.PacketPlayOutEntityLook)2 Entity (net.minecraft.server.v1_10_R1.Entity)1 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)1 PacketPlayOutSpawnEntity (net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity)1 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving)1 Entity (net.minecraft.server.v1_11_R1.Entity)1 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)1 PacketPlayOutSpawnEntity (net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity)1 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving)1 Entity (net.minecraft.server.v1_12_R1.Entity)1 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)1 PacketPlayOutSpawnEntity (net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity)1 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving)1 Entity (net.minecraft.server.v1_13_R2.Entity)1 EntityLiving (net.minecraft.server.v1_13_R2.EntityLiving)1 PacketPlayOutSpawnEntity (net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity)1 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntityLiving)1 Entity (net.minecraft.server.v1_14_R1.Entity)1 EntityLiving (net.minecraft.server.v1_14_R1.EntityLiving)1