Table of Contents

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 EnumModType
name string
modID string
version string
description string
authors IEnumerable<string>
contributors IEnumerable<string>
website string
side EnumAppSide
requiredOnClient bool
requiredOnServer bool
dependencies IEnumerable<ModDependency>

Fields

CoreMod

Not exposed as a JsonProperty, only coded mods can set this to true

public bool CoreMod

Field Value

bool

Description

A short description of what this mod does. (optional)

[JsonProperty]
public string Description

Field Value

string

Name

The name of this mod. For example "My Example Mod".

[JsonRequired]
public string Name

Field Value

string

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

string

TextureSize

If the mod is a texture pack that changes topsoil grass textures, define the texture size here

[JsonProperty]
public int TextureSize

Field Value

int

Type

The type of this mod. Can be "Theme", "Content" or "Code".

[JsonRequired]
public EnumModType Type

Field Value

EnumModType

Version

The version of this mod. For example "2.10.4". (optional)

[JsonProperty]
public string Version

Field Value

string

Website

Location of the website or project site of this mod. (optional)

[JsonProperty]
public string Website

Field Value

string

Properties

Authors

Names of people working on this mod. (optional)

[JsonProperty]
public IReadOnlyList<string> Authors { get; set; }

Property Value

IReadOnlyList<string>

Contributors

Names of people contributing to this mod. (optional)

[JsonProperty]
public IReadOnlyList<string> Contributors { get; set; }

Property Value

IReadOnlyList<string>

Dependencies

List of mods (and versions) this mod depends on.

[JsonProperty]
[JsonConverter(typeof(ModInfo.DependenciesConverter))]
public IReadOnlyList<ModDependency> Dependencies { get; set; }

Property Value

IReadOnlyList<ModDependency>

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

string

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

bool

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

bool

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

EnumAppSide

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 ModInfo

An 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

bool

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

Returns

string