Set of utility methods related to names and naming in general.

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.util.NameUtils;

Name: fixing

Attempts to automatically fix the given <code>input</code> string, if possible, so that it can be used to build a <br /> well-formed MCResourceLocation.

Returns: The fixed string.
Return Type: string

ZenScript
Copy
NameUtils.fixing(input as string) as string
参数类型描述
参数
input(输入)
类型
string
描述
The string that should be fixed to a MCResourceLocation-compatible format.

Name: fixing

Attempts to automatically fix the given <code>input</code> string, if possible, so that it can be used to build a <br /> well-formed MCResourceLocation.

Returns: The fixed string.
Return Type: string

ZenScript
Copy
NameUtils.fixing(input as string, mistakeHandler as BiConsumer<string,stdlib.List<string>>) as string
参数类型描述
参数
input(输入)
类型
string
描述
The string that should be fixed to a MCResourceLocation-compatible format.
参数
mistakeHandler
类型
BiConsumer<string,stdlib.List<string>>
描述
A bi-consumer that gets called if there were any mistakes in the original string. The first <br /> element is the fixed string, and the second is a list of strings containing explanations <br /> for all the identified mistakes.

Name: fromFixedName

Creates a MCResourceLocation from the given <code>input</code>, if possible, while fixing mistakes that <br /> may be present in the string.

Returns: A MCResourceLocation that represents the fixed input.
Return Type: MCResourceLocation

ZenScript
Copy
NameUtils.fromFixedName(input as string) as MCResourceLocation
参数类型描述
参数
input(输入)
类型
string
描述
The string that should be fixed and converted to a MCResourceLocation.

Name: fromFixedName

Creates a MCResourceLocation from the given <code>input</code>, if possible, while fixing mistakes that <br /> may be present in the string.

Returns: A MCResourceLocation that represents the fixed input.
Return Type: MCResourceLocation

ZenScript
Copy
NameUtils.fromFixedName(input as string, mistakeHandler as BiConsumer<string,stdlib.List<string>>) as MCResourceLocation
参数类型描述
参数
input(输入)
类型
string
描述
The string that should be fixed and converted to a MCResourceLocation.
参数
mistakeHandler
类型
BiConsumer<string,stdlib.List<string>>
描述
A bi-consumer that gets called if there were any mistakes in the original string. The first <br /> element is the fixed string, and the second is a list of strings containing explanations <br /> for all the identified mistakes.

Name: isAutogeneratedName

Verifies whether the given name has been autogenerated by CraftTweaker.

Returns: Whether the name has been autogenerated by CraftTweaker.
Return Type: boolean

ZenScript
Copy
NameUtils.isAutogeneratedName(name as MCResourceLocation) as boolean
参数类型描述
参数
name(名称)
类型
MCResourceLocation
描述
The name to verify.