Record Class FileToIdConverter

java.lang.Object
java.lang.Record
net.minecraft.resources.FileToIdConverter

public record FileToIdConverter(String prefix, String extension) extends Record
  • Field Details

    • prefix

      private final String prefix
      The field for the prefix record component.
    • extension

      private final String extension
      The field for the extension record component.
  • Constructor Details

    • FileToIdConverter

      public FileToIdConverter(String prefix, String extension)
      Creates an instance of a FileToIdConverter record class.
      Parameters:
      prefix - the value for the prefix record component
      extension - the value for the extension record component
  • Method Details

    • json

      public static FileToIdConverter json(String prefix)
    • registry

      public static FileToIdConverter registry(ResourceKey<? extends Registry<?>> registry)
    • idToFile

      public Identifier idToFile(Identifier id)
    • fileToId

      public Identifier fileToId(Identifier file)
    • extensionMatches

      public boolean extensionMatches(Identifier id)
    • listMatchingResources

      public Map<Identifier, Resource> listMatchingResources(ResourceManager manager)
    • listMatchingResourceStacks

      public Map<Identifier, List<Resource>> listMatchingResourceStacks(ResourceManager manager)
    • listMatchingResourcesFromNamespace

      public Map<Identifier, Resource> listMatchingResourcesFromNamespace(ResourceManager manager, String namespace)
      List all resources under the given namespace which match this converter
      Parameters:
      manager - The resource manager to collect the resources from
      namespace - The namespace to search under
      Returns:
      All resources from the given namespace which match this converter
    • listMatchingResourceStacksFromNamespace

      public Map<Identifier, List<Resource>> listMatchingResourceStacksFromNamespace(ResourceManager manager, String namespace)
      List all resource stacks under the given namespace which match this converter
      Parameters:
      manager - The resource manager to collect the resources from
      namespace - The namespace to search under
      Returns:
      All resource stacks from the given namespace which match this converter
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • prefix

      public String prefix()
      Returns the value of the prefix record component.
      Returns:
      the value of the prefix record component
    • extension

      public String extension()
      Returns the value of the extension record component.
      Returns:
      the value of the extension record component