NameUtils

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;

Methods

fixing

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

Returns: The fixed string. Return Type: string

ZenScript
Copy
NameUtils.fixing(input as string) as string
ПараметрТипDescription
inputstringThe string that should be fixed to a MCResourceLocation-compatible format.
fixing

Attempts to automatically fix the given input string, if possible, so that it can be used to build a 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
ПараметрТипDescription
inputstringThe string that should be fixed to a MCResourceLocation-compatible format.
mistakeHandlerBiConsumer<string,stdlib.List<string>>A bi-consumer that gets called if there were any mistakes in the original string. The first
element is the fixed string, and the second is a list of strings containing explanations for all the identified mistakes.
fromFixedName

Creates a MCResourceLocation from the given input, if possible, while fixing mistakes that 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
ПараметрТипDescription
inputstringThe string that should be fixed and converted to a MCResourceLocation.
fromFixedName

Creates a MCResourceLocation from the given input, if possible, while fixing mistakes that 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
ПараметрТипDescription
inputstringThe string that should be fixed and converted to a MCResourceLocation.
mistakeHandlerBiConsumer<string,stdlib.List<string>>A bi-consumer that gets called if there were any mistakes in the original string. The first
element is the fixed string, and the second is a list of strings containing explanations for all the identified mistakes.