Package com.fastasyncworldedit.core.util
Class NbtUtils
java.lang.Object
com.fastasyncworldedit.core.util.NbtUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddUUIDToMap(Map<String, org.enginehub.linbus.tree.LinTag<?>> map, UUID uuid) Adds a UUID to the given mapstatic Vector3entityPosition(FaweCompoundTag compoundTag) Returns the position data of the given tag.static <T extends org.enginehub.linbus.tree.LinTag>
TgetChildTag(org.enginehub.linbus.tree.LinCompoundTag tag, String key, org.enginehub.linbus.tree.LinTagType expected) Get child tag of a NBT structure.static intGet an integer from a tag.getLinCompoundTagValues(org.enginehub.linbus.tree.LinCompoundTag tag) Get a mutable map of the values stored inside aLinCompoundTagstatic UUIDuuid(FaweCompoundTag compoundTag) Tries to extract UUID information from a compound tagstatic org.enginehub.linbus.tree.LinCompoundTagwithEntityInfo(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.static FaweCompoundTagwithPosition(FaweCompoundTag tag, int x, int y, int z) Create a copy of the tag and modify the (x, y, z) coordinatesstatic org.enginehub.linbus.tree.LinCompoundTagwithPosition(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
-
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 fromkey- the key to look forexpected- 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 fromkey- 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 aLinCompoundTag- Parameters:
tag-LinCompoundTagto get values for- Returns:
- Mutable map of values
- Since:
- 2.1.0
-
uuid
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 copyx- New X coordinatey- New Y coordinatez- 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 copyx- New X coordinatey- New Y coordinatez- 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 copyentity- 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
Adds a UUID to the given map- Parameters:
map- the map to insert touuid- the uuid to insert- Since:
- 2.11.2
-
entityPosition
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
-