コード例 #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);
        }
コード例 #2
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteInt((int)client.PlayerPosition.X);
     buffer.WriteInt((int)client.PlayerPosition.FeetY);
     buffer.WriteInt((int)client.PlayerPosition.Z);
 }
コード例 #3
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     MinecraftServer.Core.Network.Server.ViewModel.Warning("Block Change : Block(" + X + ", " + Y + ", " + Z + "), NewID = " + BlockID);
     buffer.WriteVarint(ID);
     buffer.WriteInt(X);
     buffer.WriteByte(Y);
     buffer.WriteInt(Z);
     buffer.WriteVarint(BlockID);
     buffer.WriteByte(BlockMeta);
 }
コード例 #4
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteInt(Id);
     buffer.WriteByteAngle(Yaw);
     buffer.WriteByteAngle(Pitch);
 }
コード例 #5
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteInt(Dimension);
     buffer.WriteByte(Difficulty);
     buffer.WriteByte(Gamemode);
     buffer.WriteString(LevelType);
 }
コード例 #6
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteByte((byte)Entities.Count);
     foreach (int i in Entities)
     {
         buffer.WriteInt(i);
     }
 }
コード例 #7
0
        protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
        {
            Random r = new Random();

            KeepAlive = r.Next(int.MinValue, int.MaxValue);

            buffer.WriteVarint(ID);
            buffer.WriteInt(KeepAlive);
        }
コード例 #8
0
        protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
        {
            client.PlayerMetadata.GameMode = 1;

            buffer.WriteVarint(ID);
            buffer.WriteInt(4);
            buffer.WriteByte(1);
            buffer.WriteByte(0);
            buffer.WriteByte(1);
            buffer.WriteByte(32);
            buffer.WriteString("default");
        }
コード例 #9
0
 protected override void OnBeforeWrite(Network.Client client, Server.Core.Stream.ByteBuffer buffer)
 {
     buffer.WriteVarint(ID);
     buffer.WriteInt(Id);
     //buffer.WriteByte(Convert.ToByte(DX));
     //buffer.WriteByte(Convert.ToByte(DY));
     //buffer.WriteByte(Convert.ToByte(DZ));
     //buffer.WriteByte(0);
     //buffer.WriteByte(0);
     buffer.WriteFixedPointByte(DX);
     buffer.WriteFixedPointByte(DY);
     buffer.WriteFixedPointByte(DZ);
 }