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
- 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
componentsToRemove
int
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
component
string
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
components
string[]
Returns
CodeWithPath(string)
Returns a new assetlocation with an equal domain and the given path
public AssetLocation CodeWithPath(string path)
Parameters
path
string
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
valuesByType
Dictionary<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
componentsToRemove
int
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
input
stringsearchReplace
OrderedDictionary<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
input
AssetLocationsearchReplace
OrderedDictionary<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
posFromLeft
int
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
posFromRight
int
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
wildCard
string
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
wildcards
string[]
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
wildCard
AssetLocation
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
wildcards
AssetLocation[]