Ejemplo n.º 1
0
        public override async Task <byte[]> ToArrayAsync()
        {
            using (var stream = new MinecraftStream())
            {
                await stream.WriteVarIntAsync(this.Id);

                if (this.Uuid3 != null)
                {
                    await stream.WriteAsync(Encoding.UTF8.GetBytes(this.Uuid3));

                    Console.WriteLine("UUID is  null");
                }
                else
                {
                    Console.WriteLine("UUID is not null");
                    await stream.WriteUuidAsync(this.Uuid);
                }

                await stream.WriteDoubleAsync(this.Tranform.X);

                await stream.WriteDoubleAsync(this.Tranform.Y);

                await stream.WriteDoubleAsync(this.Tranform.Z);

                await stream.WriteAngleAsync(this.Tranform.Yaw);

                await stream.WriteAngleAsync(this.Tranform.Pitch);

                await Player.WriteAsync(stream);

                return(stream.ToArray());
            }
        }