Interface NumberTag

All Superinterfaces:
Tag
All Known Implementing Classes:
ByteTag, DoubleTag, FloatTag, IntTag, LongTag, ShortTag

public interface NumberTag extends Tag
Abstract class representing a number tag, containing methods to return primitive number types.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Gets the boolean value of this tag.
    byte
    Gets the byte value of this tag.
    double
    Gets the double value of this tag.
    float
    Gets the float value of this tag.
    int
    Gets the int value of this tag.
    long
    Gets the long value of this tag.
    short
    Gets the short value of this tag.
    default NumberTag
    Returns a copy of this tag.
    Gets the number value of this tag.

    Methods inherited from interface com.viaversion.nbt.tag.Tag

    asRawString, getTagId, write
  • Method Details

    • getValue

      Number getValue()
      Gets the number value of this tag.
      Specified by:
      getValue in interface Tag
      Returns:
      Number value of this tag.
    • asByte

      byte asByte()
      Gets the byte value of this tag.
      Returns:
      Byte value of this tag.
    • asShort

      short asShort()
      Gets the short value of this tag.
      Returns:
      Short value of this tag.
    • asInt

      int asInt()
      Gets the int value of this tag.
      Returns:
      Int value of this tag.
    • asLong

      long asLong()
      Gets the long value of this tag.
      Returns:
      Long value of this tag.
    • asFloat

      float asFloat()
      Gets the float value of this tag.
      Returns:
      Float value of this tag.
    • asDouble

      double asDouble()
      Gets the double value of this tag.
      Returns:
      Double value of this tag.
    • asBoolean

      default boolean asBoolean()
      Gets the boolean value of this tag.

      Booleans do not have a direct nbt representation in NBT per se, but check whether a number value is different to 0.

      Returns:
      Boolean value of this tag.
    • copy

      default NumberTag copy()
      Description copied from interface: Tag
      Returns a copy of this tag.
      Specified by:
      copy in interface Tag
      Returns:
      a copy of this tag