Search in sources :

Example 36 with Packet

use of net.minecraft.server.v1_13_R2.Packet in project MechanicsMain by WeaponMechanics.

the class FakeEntity_1_13_R2 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_13_R2.PacketPlayOutEntity.PacketPlayOutEntityLook)

Aggregations

Location (org.bukkit.Location)10 GameProfile (com.mojang.authlib.GameProfile)9 CraftPlayer (org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer)6 Packet (com.yahoo.fs4.Packet)4 Player (org.bukkit.entity.Player)4 BasicPacket (com.yahoo.fs4.BasicPacket)3 ChannelTimeoutException (com.yahoo.fs4.ChannelTimeoutException)3 QueryPacket (com.yahoo.fs4.QueryPacket)3 Packet (ejip123.Packet)3 EntityPlayer (net.minecraft.server.v1_13_R2.EntityPlayer)3 GetDocSumsPacket (com.yahoo.fs4.GetDocSumsPacket)2 PingPacket (com.yahoo.fs4.PingPacket)2 PongPacket (com.yahoo.fs4.PongPacket)2 QueryResultPacket (com.yahoo.fs4.QueryResultPacket)2 InvalidChannelException (com.yahoo.fs4.mplex.InvalidChannelException)2 Result (com.yahoo.search.Result)2 IOException (java.io.IOException)2 PacketPlayOutEntityLook (net.minecraft.server.v1_13_R2.PacketPlayOutEntity.PacketPlayOutEntityLook)2 Packet (net.minecraft.server.v1_15_R1.Packet)2 Packet (net.minecraft.server.v1_8_R3.Packet)2