Class NameUtil

java.lang.Object
com.blamejared.crafttweaker.api.util.NameUtil

@ZenRegister public final class NameUtil extends Object
Set of utility methods related to names and naming in general.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    fixing(String input)
    Attempts to automatically fix the given input string, if possible, so that it can be used to build a well-formed ResourceLocation.
    static String
    fixing(String input, BiConsumer<String,List<String>> mistakeHandler)
    Attempts to automatically fix the given input string, if possible, so that it can be used to build a well-formed ResourceLocation.
    static net.minecraft.resources.ResourceLocation
    Creates a ResourceLocation from the given input, if possible, while fixing mistakes that may be present in the string.
    static net.minecraft.resources.ResourceLocation
    fromFixedName(String input, BiConsumer<String,List<String>> mistakeHandler)
    Creates a ResourceLocation from the given input, if possible, while fixing mistakes that may be present in the string.
    static net.minecraft.resources.ResourceLocation
     
    static boolean
    isAutogeneratedName(net.minecraft.resources.ResourceLocation name)
    Verifies whether the given name has been autogenerated by CraftTweaker.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NameUtil

      public NameUtil()
  • Method Details

    • fromFixedName

      public static net.minecraft.resources.ResourceLocation fromFixedName(String input)
      Creates a ResourceLocation from the given input, if possible, while fixing mistakes that may be present in the string.
      Parameters:
      input - The string that should be fixed and converted to a ResourceLocation.
      Returns:
      A ResourceLocation that 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 a ResourceLocation from the given input, if possible, while fixing mistakes that may be present in the string.
      Parameters:
      input - The string that should be fixed and converted to a ResourceLocation.
      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 ResourceLocation that represents the fixed input.
      Throws:
      IllegalArgumentException - If the string cannot be automatically fixed.
      net.minecraft.ResourceLocationException - If the string cannot be automatically fixed.
    • fixing

      public static String fixing(String input)
      Attempts to automatically fix the given input string, if possible, so that it can be used to build a well-formed ResourceLocation.
      Parameters:
      input - The string that should be fixed to a ResourceLocation-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

      public static String fixing(String input, BiConsumer<String,List<String>> mistakeHandler)
      Attempts to automatically fix the given input string, if possible, so that it can be used to build a well-formed ResourceLocation.
      Parameters:
      input - The string that should be fixed to a ResourceLocation-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

      public static net.minecraft.resources.ResourceLocation generateNameFrom(String name)