Record Class TagElement

java.lang.Object
java.lang.Record
net.mcreator.workspace.elements.TagElement
All Implemented Interfaces:
IElement

public record TagElement(TagType type, String resourcePath) extends Record implements IElement
  • Constructor Details

    • TagElement

      public TagElement(TagType type, String resourcePath)
      Creates an instance of a TagElement record class.
      Parameters:
      type - the value for the type record component
      resourcePath - the value for the resourcePath record component
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface IElement
    • getMCreatorNamespace

      public String getMCreatorNamespace()
    • getMinecraftNamespace

      public String getMinecraftNamespace(Workspace workspace)
    • hashCode

      public 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 boolean equals(Object obj)
      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:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • toString

      public 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
    • entryFromMappableElement

      public static String entryFromMappableElement(MappableElement element)
    • entryToMappableElement

      public static MappableElement entryToMappableElement(Workspace workspace, TagType type, String entry)
    • isEntryManaged

      public static boolean isEntryManaged(String rawData)
    • makeEntryManaged

      public static String makeEntryManaged(String rawData)
    • getEntryName

      public static String getEntryName(String rawData)
    • fromString

      public static TagElement fromString(String raw)
    • normalizeTag

      public static String normalizeTag(String input)
      Utility method for normalizing tag name. If input does not start with # or TAG: prefix, normalization is not performed as it is assumed input is not a tag.

      When input with TAG: (legacy use) prefix is provided, prefix is changed to #.

      In all cases, if no namespace is provided in the input, minecraft: namespace is added.

      Parameters:
      input - Tag name to normalize
      Returns:
      Normalized tag name
    • type

      public TagType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • resourcePath

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