Esempio n. 1
0
        protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
        {
            buffer.WriteVarint(ID);
            buffer.WriteInt(client.TheWorld.FlatWorld[Ndx].X);
            buffer.WriteInt(client.TheWorld.FlatWorld[Ndx].Z);
            buffer.WriteBoolean(GroundUpContinuous);
            buffer.WriteLEUShort(PrimaryBitmap);
            buffer.WriteShort((short)SecondaryBitmap);

            byte[] chunkData    = client.TheWorld.FlatWorld[Ndx].ChunkData;
            byte[] compressData = new byte[chunkData.Length];

            ConcurrentStack <Deflater> DeflaterPool = new ConcurrentStack <Deflater>();
            Deflater deflater;

            DeflaterPool.TryPop(out deflater);
            if (deflater == null)
            {
                deflater = new Deflater(5);
            }
            deflater.SetInput(chunkData, 0, chunkData.Length);
            deflater.Finish();
            int length = deflater.Deflate(compressData);

            deflater.Reset();
            DeflaterPool.Push(deflater);

            buffer.WriteInt(length);
            buffer.Write(compressData, 0, length);
        }
Esempio n. 2
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteDouble(10.0d);
     buffer.WriteDouble(128.0d);
     buffer.WriteDouble(10.0d);
     buffer.WriteFloat(0.0f);
     buffer.WriteFloat(0.0f);
     buffer.WriteBoolean(true);
 }
Esempio n. 3
0
        protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
        {
            X        = client.PlayerPosition.X;
            Y        = client.PlayerPosition.FeetY;
            Z        = client.PlayerPosition.Z;
            Yaw      = client.PlayerPosition.Yaw;
            Pitch    = client.PlayerPosition.Pitch;
            OnGround = client.PlayerPosition.OnGround;

            buffer.WriteVarint(ID);
            buffer.WriteDouble(X);
            buffer.WriteDouble(Y);
            buffer.WriteDouble(Z);
            buffer.WriteFloat((float)Yaw);
            buffer.WriteFloat((float)Pitch);
            buffer.WriteBoolean(OnGround);
        }