public MultiplayerClient(TrueCraftUser user)
 {
     User = user;
     Client = new TcpClient();
     PacketReader = new PacketReader();
     PacketReader.RegisterCorePackets();
     PacketHandlers = new PacketHandler[0x100];
     Handlers.PacketHandlers.RegisterHandlers(this);
     World = new ReadOnlyWorld();
     var repo = new BlockRepository();
     repo.DiscoverBlockProviders();
     World.World.BlockRepository = repo;
     World.World.ChunkProvider = new EmptyGenerator();
     Physics = new PhysicsEngine(World, repo);
     SocketPool = new SocketAsyncEventArgsPool(100, 200, 65536);
     connected = 0;
     cancel = new CancellationTokenSource();
 }
Exemple #2
0
        public RemoteClient(IMultiplayerServer server, IPacketReader packetReader, PacketHandler[] packetHandlers, Socket connection)
        {
            LoadedChunks = new List<Coordinates2D>();
            Server = server;
            Inventory = new InventoryWindow(server.CraftingRepository);
            InventoryWindow.WindowChange += HandleWindowChange;
            SelectedSlot = InventoryWindow.HotbarIndex;
            CurrentWindow = InventoryWindow;
            ItemStaging = ItemStack.EmptyStack;
            KnownEntities = new List<IEntity>();
            Disconnected = false;
            EnableLogging = server.EnableClientLogging;
            NextWindowID = 1;
            Connection = connection;
            SocketPool = new SocketAsyncEventArgsPool(100, 200, 65536);
            PacketReader = packetReader;
            PacketHandlers = packetHandlers;

            cancel = new CancellationTokenSource();

            StartReceive();
        }