Class RegistryObject
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
A registerable object with variants, i.e. an item, a block or an entity Open in GitHub
public abstract class RegistryObject
- Inheritance
-
RegistryObject
- Derived
- Inherited Members
- Extension Methods
Constructors
RegistryObject()
public RegistryObject()
Fields
Class
The class handeling the object
public string Class
Field Value
Code
A unique domain + code of the object. Must be globally unique for all items / all blocks / all entities.
public AssetLocation Code
Field Value
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
VariantStrict
Variant values as resolved from blocktype/itemtype. NOT set for entities - use entity.Properties.VariantStrict instead.
public OrderedDictionary<string, string> VariantStrict
Field Value
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
componentsToRemoveint
Returns
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
Returns
CodeWithParts(string)
More efficient version of CodeWithParts if there is only a single parameter
public AssetLocation CodeWithParts(string component)
Parameters
componentstring
Returns
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
componentsstring[]
Returns
CodeWithPath(string)
Returns a new assetlocation with an equal domain and the given path
public AssetLocation CodeWithPath(string path)
Parameters
pathstring
Returns
CodeWithVariant(string, string)
public AssetLocation CodeWithVariant(string type, string value)
Parameters
Returns
CodeWithVariants(Dictionary<string, string>)
public AssetLocation CodeWithVariants(Dictionary<string, string> valuesByType)
Parameters
valuesByTypeDictionary<string, string>
Returns
CodeWithVariants(string[], string[])
public AssetLocation CodeWithVariants(string[] types, string[] values)
Parameters
Returns
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
componentsToRemoveint
Returns
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
Returns
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
inputstringsearchReplaceOrderedDictionary<string, string>
Returns
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
inputAssetLocationsearchReplaceOrderedDictionary<string, string>
Returns
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
posFromLeftint
Returns
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
posFromRightint
Returns
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
wildCardstring
Returns
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
wildcardsstring[]
Returns
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
wildCardAssetLocation
Returns
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
wildcardsAssetLocation[]