private void UpdateTicking_LoadContentPacks(object sender, UpdateTickingEventArgs e) { // Remove this event handler so it only fires once this.Helper.Events.GameLoop.UpdateTicking -= this.UpdateTicking_LoadContentPacks; // Load content packs ContentPackLoader contentPackLoader = new ContentPackLoader(this._coreApiFactory.GetApi(this)); contentPackLoader.LoadContentPacks(); }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { // Read config. this.config = new ConfigManager(this.Helper).GetConfig(); // Create helper classes that make the mod work. ErrorQueue errorQueue = new ErrorQueue(this.Monitor); ContentPackLoader packLoader = new ContentPackLoader(this.Helper, this.Monitor, errorQueue); this.serializer = new DoorPositionSerializer(this.Helper.Data); this.timer = new CallbackTimer(); this.doorTileInfoManager = new GeneratedDoorTileInfoManager(); this.generator = new DoorSpriteGenerator(this.doorTileInfoManager, packLoader.LoadContentPacks(), this.Helper.Multiplayer.ModID, this.Monitor, Game1.graphics.GraphicsDevice); this.creator = new DoorCreator(this.doorTileInfoManager, this.timer, errorQueue, this.Helper.ModRegistry.Get(this.Helper.ModRegistry.ModID).Manifest.Version); this.assetLoader = new DoorAssetLoader(this.Helper.Content); this.mapTileSheetManager = new MapTileSheetManager(); this.manager = new DoorManager(this.config, this.OnDoorToggled); // Apply Harmony patches. BetterDoorsMod.Instance = this; HarmonyInstance harmony = HarmonyInstance.Create(this.Helper.ModRegistry.ModID); harmony.PatchAll(Assembly.GetExecutingAssembly()); // Attach events. this.Enable(); this.Helper.Events.Multiplayer.PeerContextReceived += this.Multiplayer_PeerContextReceived; this.Helper.Events.GameLoop.ReturnedToTitle += this.GameLoop_ReturnedToTitle; }