Table of Contents

Class RegistryObject

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

A registerable object with variants, i.e. an item, a block or an entity

public abstract class RegistryObject
Inheritance
RegistryObject
Derived
Inherited Members

Constructors

RegistryObject()

public RegistryObject()

Fields

Class

The class handeling the object

public string Class

Field Value

string

Code

A unique domain + code of the object. Must be globally unique for all items / all blocks / all entities.

public AssetLocation Code

Field Value

AssetLocation

Variant

Variant values as resolved from blocktype/itemtype. Will not throw an null pointer exception when the key does not exist, but return null instead. NOT set for entities - use entity.Properties.Variant instead

public RelaxedReadOnlyDictionary<string, string> Variant

Field Value

RelaxedReadOnlyDictionary<string, string>

VariantStrict

Variant values as resolved from blocktype/itemtype. NOT set for entities - use entity.Properties.VariantStrict instead.

public OrderedDictionary<string, string> VariantStrict

Field Value

OrderedDictionary<string, string>

Methods

CodeEndWithoutParts(int)

Removes componentsToRemove parts from the blocks code beginning by splitting it up at every occurence of a dash ('-'). Left to Right

public string CodeEndWithoutParts(int componentsToRemove)

Parameters

componentsToRemove int

Returns

string

CodeWithPart(string, int)

Replaces one part from the blocks code and replaces it with components by splitting it up at every occurence of a dash ('-')

public AssetLocation CodeWithPart(string part, int atPosition = 0)

Parameters

part string
atPosition int

Returns

AssetLocation

CodeWithParts(string)

More efficient version of CodeWithParts if there is only a single parameter

public AssetLocation CodeWithParts(string component)

Parameters

component string

Returns

AssetLocation

CodeWithParts(params string[])

Replaces the last parts from the blocks code and replaces it with components by splitting it up at every occurence of a dash ('-')

public AssetLocation CodeWithParts(params string[] components)

Parameters

components string[]

Returns

AssetLocation

CodeWithPath(string)

Returns a new assetlocation with an equal domain and the given path

public AssetLocation CodeWithPath(string path)

Parameters

path string

Returns

AssetLocation

CodeWithVariant(string, string)

public AssetLocation CodeWithVariant(string type, string value)

Parameters

type string
value string

Returns

AssetLocation

CodeWithVariants(Dictionary<string, string>)

public AssetLocation CodeWithVariants(Dictionary<string, string> valuesByType)

Parameters

valuesByType Dictionary<string, string>

Returns

AssetLocation

CodeWithVariants(string[], string[])

public AssetLocation CodeWithVariants(string[] types, string[] values)

Parameters

types string[]
values string[]

Returns

AssetLocation

CodeWithoutParts(int)

Removes componentsToRemove parts from the blocks code end by splitting it up at every occurence of a dash ('-'). Right to left.

public string CodeWithoutParts(int componentsToRemove)

Parameters

componentsToRemove int

Returns

string

FillPlaceHolder(string, string, string)

Used by the block loader to replace wildcards with their final values

public static string FillPlaceHolder(string input, string search, string replace)

Parameters

input string
search string
replace string

Returns

string

FillPlaceHolder(string, OrderedDictionary<string, string>)

Used by the block loader to replace wildcards with their final values

public static string FillPlaceHolder(string input, OrderedDictionary<string, string> searchReplace)

Parameters

input string
searchReplace OrderedDictionary<string, string>

Returns

string

FillPlaceHolder(AssetLocation, OrderedDictionary<string, string>)

Used by the block loader to replace wildcards with their final values

public static AssetLocation FillPlaceHolder(AssetLocation input, OrderedDictionary<string, string> searchReplace)

Parameters

input AssetLocation
searchReplace OrderedDictionary<string, string>

Returns

AssetLocation

FirstCodePart(int)

Returns the n-th code part. If the code contains no dash ('-') the whole code is returned. Returns null if posFromLeft is too high.

public string FirstCodePart(int posFromLeft = 0)

Parameters

posFromLeft int

Returns

string

LastCodePart(int)

Returns the n-th code part in inverse order. If the code contains no dash ('-') the whole code is returned. Returns null if posFromRight is too high.

public string LastCodePart(int posFromRight = 0)

Parameters

posFromRight int

Returns

string

WildCardMatch(string)

Returns true if given wildcard matches the blocks/items code. E.g. water-* will match all water blocks

public bool WildCardMatch(string wildCard)

Parameters

wildCard string

Returns

bool

WildCardMatch(string[])

Returns true if any given wildcard matches the blocks/items code. E.g. water-* will match all water blocks

public bool WildCardMatch(string[] wildcards)

Parameters

wildcards string[]

Returns

bool

WildCardMatch(AssetLocation)

Returns true if given wildcard matches the blocks/items code. E.g. water-* will match all water blocks

public bool WildCardMatch(AssetLocation wildCard)

Parameters

wildCard AssetLocation

Returns

bool

WildCardMatch(AssetLocation[])

Returns true if any given wildcard matches the blocks/items code. E.g. water-* will match all water blocks

public bool WildCardMatch(AssetLocation[] wildcards)

Parameters

wildcards AssetLocation[]

Returns

bool