Table of Contents

Class WildcardUtil

Namespace
Vintagestory.API.Util
Assembly
VintagestoryAPI.dll
public static class WildcardUtil
Inheritance
WildcardUtil
Inherited Members

Methods

GetWildcardValue(AssetLocation, AssetLocation)

Extract the value matched by the wildcard. For exammple for rock-* and inCode rock-granite, this method will return 'granite' Returns null if the wildcard does not match

public static string GetWildcardValue(AssetLocation wildCard, AssetLocation inCode)

Parameters

wildCard AssetLocation
inCode AssetLocation

Returns

string

Match(string, string)

public static bool Match(string needle, string haystack)

Parameters

needle string
haystack string

Returns

bool

Match(string[], string)

public static bool Match(string[] needles, string haystack)

Parameters

needles string[]
haystack string

Returns

bool

Match(AssetLocation, AssetLocation)

public static bool Match(AssetLocation needle, AssetLocation haystack)

Parameters

needle AssetLocation
haystack AssetLocation

Returns

bool

Match(AssetLocation, AssetLocation, string[])

Checks whether or not the wildcard matches for inCode, for example, returns true for wildcard rock-* and inCode rock-granite

public static bool Match(AssetLocation wildCard, AssetLocation inCode, string[] allowedVariants)

Parameters

wildCard AssetLocation
inCode AssetLocation
allowedVariants string[]

Returns

bool

MatchesVariants(AssetLocation, AssetLocation, string[])

public static bool MatchesVariants(AssetLocation wildCard, AssetLocation inCode, string[] allowedVariants)

Parameters

wildCard AssetLocation
inCode AssetLocation
allowedVariants string[]

Returns

bool

WildCardReplace(AssetLocation, AssetLocation, AssetLocation)

Returns a new AssetLocation with the wildcards (*) being filled with the blocks other Code parts, if the wildcard matches. Example this block is trapdoor-up-north. search is -up-, replace is -down-, in this case this method will return trapdoor-down-north.

public static AssetLocation WildCardReplace(this AssetLocation code, AssetLocation search, AssetLocation replace)

Parameters

code AssetLocation
search AssetLocation
replace AssetLocation

Returns

AssetLocation