Record Class StringTag

java.lang.Object
java.lang.Record
net.minecraft.nbt.StringTag
All Implemented Interfaces:
PrimitiveTag, Tag

public record StringTag(String value) extends Record implements PrimitiveTag
  • Field Details

  • Constructor Details

    • StringTag

      @Deprecated(forRemoval=true) public StringTag(String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an instance of a StringTag record class.
      Parameters:
      value - the value for the value record component
  • Method Details

    • skipString

      public static void skipString(DataInput p_197564_) throws IOException
      Throws:
      IOException
    • valueOf

      public static StringTag valueOf(String p_129298_)
    • write

      public void write(DataOutput p_129296_) throws IOException
      Specified by:
      write in interface Tag
      Throws:
      IOException
    • sizeInBytes

      public int sizeInBytes()
      Specified by:
      sizeInBytes in interface Tag
    • getId

      public byte getId()
      Specified by:
      getId in interface Tag
    • getType

      public TagType<StringTag> getType()
      Specified by:
      getType in interface Tag
    • 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 interface Tag
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • copy

      public StringTag copy()
      Specified by:
      copy in interface PrimitiveTag
      Specified by:
      copy in interface Tag
    • asString

      public Optional<String> asString()
      Specified by:
      asString in interface Tag
    • accept

      public void accept(TagVisitor p_178154_)
      Specified by:
      accept in interface Tag
    • quoteAndEscape

      public static String quoteAndEscape(String p_129304_)
    • quoteAndEscape

      public static void quoteAndEscape(String p_410719_, StringBuilder p_409607_)
    • accept

      Specified by:
      accept in interface Tag
    • 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.
    • value

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