Class NbtDataImpl

java.lang.Object
net.minestom.server.data.DataImpl
net.minestom.server.data.NbtDataImpl
All Implemented Interfaces:
Data

public class NbtDataImpl
extends DataImpl
A data implementation backed by a NBTCompound.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String KEY_PREFIX  

    Fields inherited from class net.minestom.server.data.DataImpl

    data, dataType

    Fields inherited from interface net.minestom.server.data.Data

    EMPTY
  • Constructor Summary

    Constructors 
    Constructor Description
    NbtDataImpl()  
  • Method Summary

    Modifier and Type Method Description
    Data copy()
    Copies this data.
    void writeToNbt​(org.jglrxavpok.hephaistos.nbt.NBTCompound nbtCompound)
    Writes all the data into a NBTCompound.

    Methods inherited from class net.minestom.server.data.DataImpl

    get, getKeys, getOrDefault, hasKey, isEmpty, set

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minestom.server.data.Data

    set
  • Field Details

  • Constructor Details

  • Method Details

    • copy

      @NotNull public Data copy()
      Description copied from interface: Data
      Copies this data.
      Specified by:
      copy in interface Data
      Overrides:
      copy in class DataImpl
      Returns:
      a cloned data object
    • writeToNbt

      public void writeToNbt​(@NotNull org.jglrxavpok.hephaistos.nbt.NBTCompound nbtCompound)
      Writes all the data into a NBTCompound.
      Parameters:
      nbtCompound - the nbt compound to write to
      Throws:
      java.lang.NullPointerException - if the type of a data is not a primitive nbt type and therefore not supported (you can use DataType.encode(BinaryWriter, Object) to use byte array instead)