Class ModInfo
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Meta data for a specific mod folder, archive, source file or assembly. Either loaded from a "modinfo.json" or from the assembly's ModInfoAttribute.
public class ModInfo : IComparable<ModInfo>
- Inheritance
-
ModInfo
- Implements
- Inherited Members
- Extension Methods
Constructors
ModInfo()
public ModInfo()
ModInfo(EnumModType, string, string, string, string, IEnumerable<string>, IEnumerable<string>, string, EnumAppSide, bool, bool, IEnumerable<ModDependency>)
public ModInfo(EnumModType type, string name, string modID, string version, string description, IEnumerable<string> authors, IEnumerable<string> contributors, string website, EnumAppSide side, bool requiredOnClient, bool requiredOnServer, IEnumerable<ModDependency> dependencies)
Parameters
type
EnumModTypename
stringmodID
stringversion
stringdescription
stringauthors
IEnumerable<string>contributors
IEnumerable<string>website
stringside
EnumAppSiderequiredOnClient
boolrequiredOnServer
booldependencies
IEnumerable<ModDependency>
Fields
CoreMod
Not exposed as a JsonProperty, only coded mods can set this to true
public bool CoreMod
Field Value
Description
A short description of what this mod does. (optional)
[JsonProperty]
public string Description
Field Value
Name
The name of this mod. For example "My Example Mod".
[JsonRequired]
public string Name
Field Value
NetworkVersion
The network version of this mod. Change this number when a user that has an older version of your mod should not be allowed to connected to server with a newer version. If not set, the version value is used.
[JsonProperty]
public string NetworkVersion
Field Value
TextureSize
If the mod is a texture pack that changes topsoil grass textures, define the texture size here
[JsonProperty]
public int TextureSize
Field Value
Type
The type of this mod. Can be "Theme", "Content" or "Code".
[JsonRequired]
public EnumModType Type
Field Value
Version
The version of this mod. For example "2.10.4". (optional)
[JsonProperty]
public string Version
Field Value
Website
Location of the website or project site of this mod. (optional)
[JsonProperty]
public string Website
Field Value
Properties
Authors
Names of people working on this mod. (optional)
[JsonProperty]
public IReadOnlyList<string> Authors { get; set; }
Property Value
Contributors
Names of people contributing to this mod. (optional)
[JsonProperty]
public IReadOnlyList<string> Contributors { get; set; }
Property Value
Dependencies
List of mods (and versions) this mod depends on.
[JsonProperty]
[JsonConverter(typeof(ModInfo.DependenciesConverter))]
public IReadOnlyList<ModDependency> Dependencies { get; set; }
Property Value
ModID
The mod id (domain) of this mod. For example "myexamplemod". (Optional. Uses mod name (converted to lowercase, stripped of whitespace and special characters) if missing.)
[JsonProperty]
public string ModID { get; set; }
Property Value
RequiredOnClient
If set to false and the mod is universal, clients don't need the mod to join. (Optional. True by default.)
[JsonProperty]
public bool RequiredOnClient { get; set; }
Property Value
RequiredOnServer
If set to false and the mod is universal, the mod is not disabled if it's not present on the server. (Optional. True by default.)
[JsonProperty]
public bool RequiredOnServer { get; set; }
Property Value
Side
Which side(s) this mod runs on. Can be "Server", "Client" or "Universal". (Optional. Universal (both server and client) by default.)
[JsonProperty]
[JsonConverter(typeof(StringEnumConverter))]
public EnumAppSide Side { get; set; }
Property Value
Methods
CompareTo(ModInfo)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(ModInfo other)
Parameters
other
ModInfoAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
Init()
public void Init()
IsValidModID(string)
Returns whether the specified domain is valid.
Tests if the string is non-null, has a length of at least 1, starts with a basic lowercase letter and contains only lowercase letters and numbers.
public static bool IsValidModID(string str)
Parameters
str
string
Returns
ToModID(string)
Attempts to convert the specified mod name to a mod ID, stripping any non-alphanumerical (including spaces and dashes) and lowercasing letters.
public static string ToModID(string name)
Parameters
name
string