Example #1
0
        public MultiplayerServer()
        {
            var reader = new PacketReader();

            PacketReader      = reader;
            Clients           = new List <IRemoteClient>();
            EnvironmentWorker = new Timer(DoEnvironment);
            PacketHandlers    = new PacketHandler[0x100];
            Worlds            = new List <IWorld>();
            EntityManagers    = new List <IEntityManager>();
            LogProviders      = new List <ILogProvider>();
            Scheduler         = new EventScheduler(this);
            var blockRepository = new BlockRepository();

            blockRepository.DiscoverBlockProviders();
            BlockRepository = blockRepository;
            var itemRepository = new ItemRepository();

            itemRepository.DiscoverItemProviders();
            ItemRepository = itemRepository;
            var craftingRepository = new CraftingRepository();

            craftingRepository.DiscoverRecipes();
            CraftingRepository  = craftingRepository;
            PendingBlockUpdates = new Queue <BlockUpdate>();
            EnableClientLogging = false;
            QueryProtocol       = new TrueCraft.QueryProtocol(this);

            AccessConfiguration = Configuration.LoadConfiguration <AccessConfiguration>("access.yaml");

            reader.RegisterCorePackets();
            Handlers.PacketHandlers.RegisterHandlers(this);
        }
Example #2
0
        public MultiplayerServer()
        {
            var reader = new PacketReader();

            PacketReader      = reader;
            Clients           = new List <IRemoteClient>();
            NetworkWorker     = new Thread(new ThreadStart(DoNetwork));
            EnvironmentWorker = new Timer(DoEnvironment);
            PacketHandlers    = new PacketHandler[0x100];
            Worlds            = new List <IWorld>();
            EntityManagers    = new List <IEntityManager>();
            LogProviders      = new List <ILogProvider>();
            Scheduler         = new EventScheduler(this);
            var blockRepository = new BlockRepository();

            blockRepository.DiscoverBlockProviders();
            BlockRepository = blockRepository;
            var itemRepository = new ItemRepository();

            itemRepository.DiscoverItemProviders();
            ItemRepository = itemRepository;
            var craftingRepository = new CraftingRepository();

            craftingRepository.DiscoverRecipes();
            CraftingRepository  = craftingRepository;
            PendingBlockUpdates = new Queue <BlockUpdate>();
            EnableClientLogging = false;

            reader.RegisterCorePackets();
            Handlers.PacketHandlers.RegisterHandlers(this);
        }