コード例 #1
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteFloat(0.0f);
     buffer.WriteShort(0);
     buffer.WriteShort(0);
 }
コード例 #2
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteFloat(Health);
     buffer.WriteShort(Food);
     buffer.WriteFloat(FoodSaturation);
 }
コード例 #3
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);
        }
コード例 #4
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteVarint(PlayerEntityId);
     buffer.WriteString(PlayerUUID);
     buffer.WriteString(PlayerName);
     buffer.WriteFixedPoint(PlayerX);
     buffer.WriteFixedPoint(PlayerY);
     buffer.WriteFixedPoint(PlayerZ);
     buffer.WriteByte(PlayerYaw);
     buffer.WriteByte(PlayerPitch);
     buffer.WriteShort(CurrentItem);
     buffer.WriteByte((3 << 5) | 6);
     buffer.WriteFloat(Health);
     buffer.WriteByte(0x7F);
 }