Record Class NbtShort

java.lang.Object
java.lang.Record
net.minecraft.nbt.NbtShort
Record Components:
value -
All Implemented Interfaces:
AbstractNbtNumber, NbtElement, NbtPrimitive

public record NbtShort(short value) extends Record implements AbstractNbtNumber
Represents an NBT 16-bit integer. Its type is 0x2. Instances are immutable.
Mappings:
Namespace Name
named net/minecraft/nbt/NbtShort
intermediary net/minecraft/class_2516
official ut
named value
intermediary comp_3822
official b
  • Field Details Link icon

    • value Link icon

      private final short value
      The field for the value record component.
    • SIZE Link icon

      private static final int SIZE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named SIZE Lnet/minecraft/nbt/NbtShort;SIZE:I
      intermediary field_41728 Lnet/minecraft/class_2516;field_41728:I
      official c Lut;c:I
    • TYPE Link icon

      public static final NbtType<NbtShort> TYPE
      Mappings:
      Namespace Name Mixin selector
      named TYPE Lnet/minecraft/nbt/NbtShort;TYPE:Lnet/minecraft/nbt/NbtType;
      intermediary field_21043 Lnet/minecraft/class_2516;field_21043:Lnet/minecraft/class_4614;
      official a Lut;a:Lvc;
  • Constructor Details Link icon

    • NbtShort Link icon

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

    • of Link icon

      public static NbtShort of(short value)
      Returns the NBT short from value.
      Returns:
      the NBT short from value
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/nbt/NbtShort;of(S)Lnet/minecraft/nbt/NbtShort;
      intermediary method_23254 Lnet/minecraft/class_2516;method_23254(S)Lnet/minecraft/class_2516;
      official a Lut;a(S)Lut;
    • write Link icon

      public void write(DataOutput output) throws IOException
      Writes the NBT element to output.
      Specified by:
      write in interface NbtElement
      Throws:
      IOException
      API Note:
      This is a low-level method for serializing NBT elements; consider using NbtIo, NbtOps, or PacketByteBuf.writeNbt(net.minecraft.nbt.NbtElement) instead.
      Mappings:
      Namespace Name Mixin selector
      named write Lnet/minecraft/nbt/NbtElement;write(Ljava/io/DataOutput;)V
      intermediary method_10713 Lnet/minecraft/class_2520;method_10713(Ljava/io/DataOutput;)V
      official a Lva;a(Ljava/io/DataOutput;)V
    • getSizeInBytes Link icon

      public int getSizeInBytes()
      Specified by:
      getSizeInBytes in interface NbtElement
      Mappings:
      Namespace Name Mixin selector
      named getSizeInBytes Lnet/minecraft/nbt/NbtElement;getSizeInBytes()I
      intermediary method_47988 Lnet/minecraft/class_2520;method_47988()I
      official a Lva;a()I
    • getType Link icon

      public byte getType()
      Returns the type of this NBT element.
      Specified by:
      getType in interface NbtElement
      Returns:
      the type of this NBT element
      Mappings:
      Namespace Name Mixin selector
      named getType Lnet/minecraft/nbt/NbtElement;getType()B
      intermediary method_10711 Lnet/minecraft/class_2520;method_10711()B
      official b Lva;b()B
    • getNbtType Link icon

      public NbtType<NbtShort> getNbtType()
      Returns the NBT type definition of this NBT element.
      Specified by:
      getNbtType in interface NbtElement
      Returns:
      the NBT type definition of this NBT element
      Mappings:
      Namespace Name Mixin selector
      named getNbtType Lnet/minecraft/nbt/NbtElement;getNbtType()Lnet/minecraft/nbt/NbtType;
      intermediary method_23258 Lnet/minecraft/class_2520;method_23258()Lnet/minecraft/class_4614;
      official c Lva;c()Lvc;
    • copy Link icon

      public NbtShort copy()
      Description copied from interface: NbtPrimitive
      Returns an NBT element of equal value that won't change with this element.
      Specified by:
      copy in interface NbtElement
      Specified by:
      copy in interface NbtPrimitive
      Returns:
      an NBT element of equal value that won't change with this element
      Mappings:
      Namespace Name Mixin selector
      named copy Lnet/minecraft/nbt/NbtShort;copy()Lnet/minecraft/nbt/NbtShort;
      intermediary method_10704 Lnet/minecraft/class_2516;method_10704()Lnet/minecraft/class_2516;
      official e Lut;e()Lut;
    • accept Link icon

      public void accept(NbtElementVisitor visitor)
      Specified by:
      accept in interface NbtElement
      Mappings:
      Namespace Name Mixin selector
      named accept Lnet/minecraft/nbt/NbtElement;accept(Lnet/minecraft/nbt/visitor/NbtElementVisitor;)V
      intermediary method_32289 Lnet/minecraft/class_2520;method_32289(Lnet/minecraft/class_5627;)V
      official a Lva;a(Lve;)V
    • longValue Link icon

      public long longValue()
      Gets the value as a 64-bit integer.
      Specified by:
      longValue in interface AbstractNbtNumber
      Returns:
      the value as a long
      Mappings:
      Namespace Name Mixin selector
      named longValue Lnet/minecraft/nbt/AbstractNbtNumber;longValue()J
      intermediary method_10699 Lnet/minecraft/class_2514;method_10699()J
      official g Luq;g()J
    • intValue Link icon

      public int intValue()
      Gets the value as a 32-bit integer.
      Specified by:
      intValue in interface AbstractNbtNumber
      Returns:
      the value as an int
      Mappings:
      Namespace Name Mixin selector
      named intValue Lnet/minecraft/nbt/AbstractNbtNumber;intValue()I
      intermediary method_10701 Lnet/minecraft/class_2514;method_10701()I
      official h Luq;h()I
    • shortValue Link icon

      public short shortValue()
      Gets the value as a 16-bit integer.
      Specified by:
      shortValue in interface AbstractNbtNumber
      Returns:
      the value as a short
      Mappings:
      Namespace Name Mixin selector
      named shortValue Lnet/minecraft/nbt/AbstractNbtNumber;shortValue()S
      intermediary method_10696 Lnet/minecraft/class_2514;method_10696()S
      official i Luq;i()S
    • byteValue Link icon

      public byte byteValue()
      Gets the value as an 8-bit integer.
      Specified by:
      byteValue in interface AbstractNbtNumber
      Returns:
      the value as a byte
      Mappings:
      Namespace Name Mixin selector
      named byteValue Lnet/minecraft/nbt/AbstractNbtNumber;byteValue()B
      intermediary method_10698 Lnet/minecraft/class_2514;method_10698()B
      official j Luq;j()B
    • doubleValue Link icon

      public double doubleValue()
      Gets the value as a 64-bit floating-point number.
      Specified by:
      doubleValue in interface AbstractNbtNumber
      Returns:
      the value as a double
      Mappings:
      Namespace Name Mixin selector
      named doubleValue Lnet/minecraft/nbt/AbstractNbtNumber;doubleValue()D
      intermediary method_10697 Lnet/minecraft/class_2514;method_10697()D
      official k Luq;k()D
    • floatValue Link icon

      public float floatValue()
      Gets the value as a 32-bit floating-point number.
      Specified by:
      floatValue in interface AbstractNbtNumber
      Returns:
      the value as a float
      Mappings:
      Namespace Name Mixin selector
      named floatValue Lnet/minecraft/nbt/AbstractNbtNumber;floatValue()F
      intermediary method_10700 Lnet/minecraft/class_2514;method_10700()F
      official l Luq;l()F
    • numberValue Link icon

      public Number numberValue()
      Gets the value as a generic number.
      Specified by:
      numberValue in interface AbstractNbtNumber
      Returns:
      the value as a Number
      Mappings:
      Namespace Name Mixin selector
      named numberValue Lnet/minecraft/nbt/AbstractNbtNumber;numberValue()Ljava/lang/Number;
      intermediary method_10702 Lnet/minecraft/class_2514;method_10702()Ljava/lang/Number;
      official m Luq;m()Ljava/lang/Number;
    • doAccept Link icon

      public NbtScanner.Result doAccept(NbtScanner visitor)
      Specified by:
      doAccept in interface NbtElement
      Mappings:
      Namespace Name Mixin selector
      named doAccept Lnet/minecraft/nbt/NbtElement;doAccept(Lnet/minecraft/nbt/scanner/NbtScanner;)Lnet/minecraft/nbt/scanner/NbtScanner$Result;
      intermediary method_39850 Lnet/minecraft/class_2520;method_39850(Lnet/minecraft/class_6836;)Lnet/minecraft/class_6836$class_6838;
      official a Lva;a(Lux;)Lux$b;
    • toString Link icon

      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 NbtElement
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode Link icon

      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 Link icon

      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 Link icon

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