using System; using StardewModdingAPI.Events; namespace StardewModdingAPI { /// Provides simplified APIs for writing mods. public interface IModHelper { /********* ** Accessors *********/ /// The full path to the mod's folder. string DirectoryPath { get; } /// Manages access to events raised by SMAPI, which let your mod react when something happens in the game. IModEvents Events { get; } /// An API for managing console commands. ICommandHelper ConsoleCommands { get; } /// An API for loading content assets from the game's Content folder or using the events. IGameContentHelper GameContent { get; } /// An API for loading content assets from your mod's files. /// This API is intended for reading content assets from the mod files (like game data, images, etc); see also which is intended for persisting internal mod data. IModContentHelper ModContent { get; } /// An API for loading content assets. [Obsolete($"Use {nameof(IGameContentHelper)} or {nameof(IModContentHelper)} instead.")] IContentHelper Content { get; } /// An API for managing content packs. IContentPackHelper ContentPacks { get; } /// An API for reading and writing persistent mod data. /// This API is intended for persisting internal mod data; see also which is intended for reading content assets (like game data, images, etc). IDataHelper Data { get; } /// An API for checking and changing input state. IInputHelper Input { get; } /// Simplifies access to private game code. IReflectionHelper Reflection { get; } /// Metadata about loaded mods. IModRegistry ModRegistry { get; } /// Provides multiplayer utilities. IMultiplayerHelper Multiplayer { get; } /// Provides translations stored in the mod's i18n folder, with one file per locale (like en.json) containing a flat key => value structure. Translations are fetched with locale fallback, so missing translations are filled in from broader locales (like pt-BR.json < pt.json < default.json). ITranslationHelper Translation { get; } /********* ** Public methods *********/ /**** ** Mod config file ****/ /// Read the mod's configuration file (and create it if needed). /// The config class type. This should be a plain class that has public properties for the settings you want. These can be complex types. TConfig ReadConfig() where TConfig : class, new(); /// Save to the mod's configuration file. /// The config class type. /// The config settings to save. void WriteConfig(TConfig config) where TConfig : class, new(); } }