Ejemplo n.º 1
0
        public void StartClient()
        {
            Skin skin = new Skin
            {
                Slim     = false,
                Texture  = Encoding.Default.GetBytes(new string('Z', 8192)),
                SkinType = "Standard_Custom"
            };

            var nodeServer = new NodeServer(_endPoint);

            PlayerInfo playerInfo = new PlayerInfo
            {
                Username      = _username,
                ClientUuid    = new UUID(Guid.NewGuid().ToString()),
                ClientId      = ClientId,
                ServerAddress = "localhost",
                Skin          = skin
            };

            _fromNodeHander = new MockNetworkHandler(this);
            _toNodeHandler  = (BaseMessageHandler)nodeServer.CreatePlayer(_fromNodeHander, playerInfo);

            if (_toNodeHandler == null)
            {
                IsRunning = false;
                return;
            }

            _toNodeHandler.HandleMcpeClientToServerHandshake(null);

            McpeRequestChunkRadius radius = McpeRequestChunkRadius.CreateObject();

            radius.chunkRadius = ChunkRadius;

            _toNodeHandler.WriteBytes(radius.Encode());
            radius.PutPool();

            IsRunning = true;
        }