Class NameUtil
java.lang.Object
com.blamejared.crafttweaker.api.util.NameUtil
Set of utility methods related to names and naming in general.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringAttempts to automatically fix the giveninputstring, if possible, so that it can be used to build a well-formedResourceLocation.static StringAttempts to automatically fix the giveninputstring, if possible, so that it can be used to build a well-formedResourceLocation.static net.minecraft.resources.ResourceLocationfromFixedName(String input) Creates aResourceLocationfrom the giveninput, if possible, while fixing mistakes that may be present in the string.static net.minecraft.resources.ResourceLocationfromFixedName(String input, BiConsumer<String, List<String>> mistakeHandler) Creates aResourceLocationfrom the giveninput, if possible, while fixing mistakes that may be present in the string.static net.minecraft.resources.ResourceLocationgenerateNameFrom(String name) static booleanisAutogeneratedName(net.minecraft.resources.ResourceLocation name) Verifies whether the given name has been autogenerated by CraftTweaker.
-
Constructor Details
-
NameUtil
public NameUtil()
-
-
Method Details
-
fromFixedName
Creates aResourceLocationfrom the giveninput, if possible, while fixing mistakes that may be present in the string.- Parameters:
input- The string that should be fixed and converted to aResourceLocation.- Returns:
- A
ResourceLocationthat represents the fixed input. - Throws:
IllegalArgumentException- If the string cannot be automatically fixed.net.minecraft.ResourceLocationException- If the string cannot be automatically fixed.
-
fromFixedName
public static net.minecraft.resources.ResourceLocation fromFixedName(String input, BiConsumer<String, List<String>> mistakeHandler) Creates aResourceLocationfrom the giveninput, if possible, while fixing mistakes that may be present in the string.- Parameters:
input- The string that should be fixed and converted to aResourceLocation.mistakeHandler- 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.- Returns:
- A
ResourceLocationthat represents the fixed input. - Throws:
IllegalArgumentException- If the string cannot be automatically fixed.net.minecraft.ResourceLocationException- If the string cannot be automatically fixed.
-
fixing
Attempts to automatically fix the giveninputstring, if possible, so that it can be used to build a well-formedResourceLocation.- Parameters:
input- The string that should be fixed to aResourceLocation-compatible format.- Returns:
- The fixed string.
- Throws:
IllegalArgumentException- If the string cannot be automatically fixed.net.minecraft.ResourceLocationException- If the string cannot be automatically fixed.
-
fixing
Attempts to automatically fix the giveninputstring, if possible, so that it can be used to build a well-formedResourceLocation.- Parameters:
input- The string that should be fixed to aResourceLocation-compatible format.mistakeHandler- 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.- Returns:
- The fixed string.
- Throws:
IllegalArgumentException- If the string cannot be automatically fixed.net.minecraft.ResourceLocationException- If the string cannot be automatically fixed.
-
isAutogeneratedName
public static boolean isAutogeneratedName(net.minecraft.resources.ResourceLocation name) Verifies whether the given name has been autogenerated by CraftTweaker.- Parameters:
name- The name to verify.- Returns:
- Whether the name has been autogenerated by CraftTweaker.
-
generateNameFrom
-