Record Class ShortTag

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

public record ShortTag(short value) extends Record implements NumericTag
  • Field Details

    • value

      private final short value
      The field for the value record component.
    • SELF_SIZE_IN_BYTES

      private static final int SELF_SIZE_IN_BYTES
      See Also:
    • TYPE

      public static final TagType<ShortTag> TYPE
  • Constructor Details

    • ShortTag

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

    • valueOf

      public static ShortTag valueOf(short p_129259_)
    • write

      public void write(DataOutput p_129254_) 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<ShortTag> getType()
      Specified by:
      getType in interface Tag
    • copy

      public ShortTag copy()
      Specified by:
      copy in interface PrimitiveTag
      Specified by:
      copy in interface Tag
    • accept

      public void accept(TagVisitor p_178084_)
      Specified by:
      accept in interface Tag
    • longValue

      public long longValue()
      Specified by:
      longValue in interface NumericTag
    • intValue

      public int intValue()
      Specified by:
      intValue in interface NumericTag
    • shortValue

      public short shortValue()
      Specified by:
      shortValue in interface NumericTag
    • byteValue

      public byte byteValue()
      Specified by:
      byteValue in interface NumericTag
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in interface NumericTag
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in interface NumericTag
    • box

      public Number box()
      Specified by:
      box in interface NumericTag
    • accept

      Specified by:
      accept 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
    • 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 '=='.
      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 short value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component