Class NBTUtils

java.lang.Object
dev.selena.luacore.utils.nbt.NBTUtils

public class NBTUtils extends Object
NBT utility class mainly for serialization and storing custom nbt compounds
  • Constructor Details

    • NBTUtils

      public NBTUtils()
  • Method Details

    • storeNBTContent

      public static void storeNBTContent(de.tr7zw.changeme.nbtapi.NBTCompound compoundTag, Object content, String nameSpaceKey)
      Stores custom NBT content
      Parameters:
      compoundTag - The Compound tag you want to store in, usually use your plugins one
      content - The value of the data you want to store
      nameSpaceKey - where you should get the data from later
      See Also:
    • storeEntityNBTContent

      public static void storeEntityNBTContent(de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT readWriteNBT, Object content, String nameSpaceKey)
      Stores custom NBT content for entity
      Parameters:
      readWriteNBT - The ReadWriteNBT tag you want to store in, usually use your plugins one
      content - The value of the data you want to store
      nameSpaceKey - where you should get the data from later
      See Also:
    • storeEntityNBTContent

      public static void storeEntityNBTContent(de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT readWriteNBT, Object content, String nameSpaceKey, Type type)
      Stores custom NBT content for entity
      Parameters:
      readWriteNBT - The ReadWriteNBT tag you want to store in, usually use your plugins one
      content - The value of the data you want to store
      nameSpaceKey - where you should get the data from later
      type - The object type you want to populate
      See Also:
    • getNBTContent

      public static <T> T getNBTContent(Class<T> cls, String nameSpaceKey, de.tr7zw.changeme.nbtapi.NBTCompound compoundTag)
      Gets custom NBT data
      Type Parameters:
      T - The class type
      Parameters:
      cls - The class you want to map to
      nameSpaceKey - The key you set in storeNBTContent(NBTCompound, Object, String)
      compoundTag - The NBTCompound you are storing the custom NBT in
      Returns:
      Fully mapped class
    • getEntityNBTContent

      public static <T> T getEntityNBTContent(Class<T> cls, String nameSpaceKey, de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT readWriteNBT)
      Gets custom NBT data
      Type Parameters:
      T - The class type
      Parameters:
      cls - The class you want to map to
      nameSpaceKey - The key you set in storeEntityNBTContent(ReadWriteNBT, Object, String)
      readWriteNBT - The NBTCompound you are storing the custom NBT in
      Returns:
      Fully mapped class
    • getEntityNBTContent

      public static <T> T getEntityNBTContent(Type type, String nameSpaceKey, de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT readWriteNBT)
      Gets custom NBT data
      Type Parameters:
      T - The class type
      Parameters:
      type - The object type you want to map to
      nameSpaceKey - The key you set in storeEntityNBTContent(ReadWriteNBT, Object, String, Type)
      readWriteNBT - The NBTCompound you are storing the custom NBT in
      Returns:
      Fully mapped class