Exemplo n.º 1
0
        public void Write(IPacketWriter writer)
        {
            writer.WriteVarInt(Entity.Id);
            writer.WriteGuid(Entity.Guid);
            writer.WriteVarInt(Entity.TypeId);
            writer.WriteDouble(Entity.Position.X);
            writer.WriteDouble(Entity.Position.Y);
            writer.WriteDouble(Entity.Position.Z);

            var rotation = RotationHelper.FromLookAt(Entity.LookDir);
            var pitch    = rotation.X;
            var yaw      = rotation.Y;

            writer.WriteUInt8(RotationHelper.RadiansTo256Angle(pitch));
            writer.WriteUInt8(RotationHelper.RadiansTo256Angle(yaw));

            writer.WriteInt32(1);
            writer.WriteInt16(0);
            writer.WriteInt16(0);
            writer.WriteInt16(0);

            /*writer.WriteInt16((short)MathF.Round(Entity.Velocity.X / 8000));
            *  writer.WriteInt16((short)MathF.Round(Entity.Velocity.Y / 8000));
            *  writer.WriteInt16((short)MathF.Round(Entity.Velocity.Z / 8000));*/
        }
Exemplo n.º 2
0
 public void Write(IPacketWriter writer)
 {
     writer.WriteDouble(Position.X);
     writer.WriteDouble(Position.Y);
     writer.WriteDouble(Position.Z);
     writer.WriteSingle(Rotation.X);
     writer.WriteSingle(Rotation.Y);
     writer.WriteUInt8((byte)RelativeFlags);
     writer.WriteVarInt(TeleportId);
 }
Exemplo n.º 3
0
        public void Write(IPacketWriter writer)
        {
            writer.WriteVarInt(Entity.Id);
            writer.WriteGuid(Entity.Guid);
            writer.WriteDouble(Entity.Position.X);
            writer.WriteDouble(Entity.Position.Y);
            writer.WriteDouble(Entity.Position.Z);

            var rotation = RotationHelper.FromLookAt(Entity.LookDir);
            var pitch    = rotation.X;
            var yaw      = rotation.Y;

            writer.WriteUInt8(RotationHelper.RadiansTo256Angle(pitch));
            writer.WriteUInt8(RotationHelper.RadiansTo256Angle(yaw));
        }