Class NbtUtils

java.lang.Object
com.fastasyncworldedit.core.util.NbtUtils

public final class NbtUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addUUIDToMap(Map<String,org.enginehub.linbus.tree.LinTag<?>> map, UUID uuid)
    Adds a UUID to the given map
    static Vector3
    Returns the position data of the given tag.
    static <T extends org.enginehub.linbus.tree.LinTag>
    T
    getChildTag(org.enginehub.linbus.tree.LinCompoundTag tag, String key, org.enginehub.linbus.tree.LinTagType expected)
    Get child tag of a NBT structure.
    static int
    getInt(org.enginehub.linbus.tree.LinCompoundTag tag, String key)
    Get an integer from a tag.
    static Map<String,org.enginehub.linbus.tree.LinTag<?>>
    getLinCompoundTagValues(org.enginehub.linbus.tree.LinCompoundTag tag)
    Get a mutable map of the values stored inside a LinCompoundTag
    static UUID
    uuid(FaweCompoundTag compoundTag)
    Tries to extract UUID information from a compound tag
    static org.enginehub.linbus.tree.LinCompoundTag
    withEntityInfo(org.enginehub.linbus.tree.LinCompoundTag tag, Entity entity)
    Returns a copy of the given tag with the Id and the Pos of the given entity.
    withPosition(FaweCompoundTag tag, int x, int y, int z)
    Create a copy of the tag and modify the (x, y, z) coordinates
    static org.enginehub.linbus.tree.LinCompoundTag
    withPosition(org.enginehub.linbus.tree.LinCompoundTag tag, int x, int y, int z)
    Create a copy of the tag and modify the (x, y, z) coordinates

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getChildTag

      public static <T extends org.enginehub.linbus.tree.LinTag> T getChildTag(org.enginehub.linbus.tree.LinCompoundTag tag, String key, org.enginehub.linbus.tree.LinTagType expected) throws InvalidFormatException
      Get child tag of a NBT structure.
      Parameters:
      tag - the tag to read from
      key - the key to look for
      expected - the expected NBT class type
      Returns:
      child tag
      Throws:
      InvalidFormatException - if the format of the items is invalid
    • getInt

      public static int getInt(org.enginehub.linbus.tree.LinCompoundTag tag, String key) throws InvalidFormatException
      Get an integer from a tag.
      Parameters:
      tag - the tag to read from
      key - the key to look for
      Returns:
      child tag
      Throws:
      InvalidFormatException - if the format of the items is invalid
      Since:
      2.1.0
    • getLinCompoundTagValues

      public static Map<String,org.enginehub.linbus.tree.LinTag<?>> getLinCompoundTagValues(org.enginehub.linbus.tree.LinCompoundTag tag)
      Get a mutable map of the values stored inside a LinCompoundTag
      Parameters:
      tag - LinCompoundTag to get values for
      Returns:
      Mutable map of values
      Since:
      2.1.0
    • uuid

      public static UUID uuid(FaweCompoundTag compoundTag)
      Tries to extract UUID information from a compound tag
      Parameters:
      compoundTag - the compound tag to extract uuid information from
      Returns:
      the extracted UUID
      Since:
      2.11.2
    • withPosition

      @Nonnull public static org.enginehub.linbus.tree.LinCompoundTag withPosition(@Nonnull org.enginehub.linbus.tree.LinCompoundTag tag, int x, int y, int z)
      Create a copy of the tag and modify the (x, y, z) coordinates
      Parameters:
      tag - Tag to copy
      x - New X coordinate
      y - New Y coordinate
      z - New Z coordinate
      Returns:
      New tag
      Since:
      2.11.2
    • withPosition

      @Nonnull public static FaweCompoundTag withPosition(@Nonnull FaweCompoundTag tag, int x, int y, int z)
      Create a copy of the tag and modify the (x, y, z) coordinates
      Parameters:
      tag - Tag to copy
      x - New X coordinate
      y - New Y coordinate
      z - New Z coordinate
      Returns:
      New tag
      Since:
      2.11.2
    • withEntityInfo

      @Nonnull public static org.enginehub.linbus.tree.LinCompoundTag withEntityInfo(@Nonnull org.enginehub.linbus.tree.LinCompoundTag tag, @Nonnull Entity entity)
      Returns a copy of the given tag with the Id and the Pos of the given entity.
      Parameters:
      tag - the tag to copy
      entity - the entity to use the Id and the Pos from
      Returns:
      a copy of the given tag with the Id and the Pos of the given entity
      Since:
      2.11.2
    • addUUIDToMap

      public static void addUUIDToMap(Map<String,org.enginehub.linbus.tree.LinTag<?>> map, UUID uuid)
      Adds a UUID to the given map
      Parameters:
      map - the map to insert to
      uuid - the uuid to insert
      Since:
      2.11.2
    • entityPosition

      public static Vector3 entityPosition(FaweCompoundTag compoundTag)
      Returns the position data of the given tag.
      Parameters:
      compoundTag - the tag to extract position information from
      Returns:
      the position data of the given tag
      Since:
      2.12.0