Package net.minestom.server.tag
Interface TagHandler
- All Superinterfaces:
TagReadable
,TagWritable
Represents an element which can read and write
tags
.-
Method Summary
Modifier and TypeMethodDescription@NotNull org.jglrxavpok.hephaistos.nbt.NBTCompound
Converts the content of this handler into aNBTCompound
.@NotNull TagHandler
copy()
Creates a copy of this handler.static @NotNull TagHandler
fromCompound
(@NotNull org.jglrxavpok.hephaistos.nbt.NBTCompoundLike compound) Copy the content of the givenNBTCompoundLike
into a newTagHandler
.<T> @UnknownNullability T
getAndUpdateTag
(@NotNull Tag<T> tag, @NotNull UnaryOperator<@UnknownNullability T> value) static @NotNull TagHandler
@NotNull TagReadable
Creates a readable copy of this handler.<T> @UnknownNullability T
updateAndGetTag
(@NotNull Tag<T> tag, @NotNull UnaryOperator<@UnknownNullability T> value) void
updateContent
(@NotNull org.jglrxavpok.hephaistos.nbt.NBTCompoundLike compound) Updates the content of this handler.<T> void
updateTag
(@NotNull Tag<T> tag, @NotNull UnaryOperator<@UnknownNullability T> value) Methods inherited from interface net.minestom.server.tag.TagReadable
getTag, hasTag
Methods inherited from interface net.minestom.server.tag.TagWritable
removeTag, setTag
-
Method Details
-
readableCopy
Creates a readable copy of this handler.Similar to
asCompound()
with the advantage that cached objects and adaptive optimizations may be reused.- Returns:
- a copy of this handler
-
copy
Creates a copy of this handler.Similar to
fromCompound(NBTCompoundLike)
usingasCompound()
with the advantage that cached objects and adaptive optimizations may be reused.- Returns:
- a copy of this handler
-
updateContent
void updateContent(@NotNull @NotNull org.jglrxavpok.hephaistos.nbt.NBTCompoundLike compound) Updates the content of this handler.Can be used as a clearing method with
NBTCompound.EMPTY
.- Parameters:
compound
- the new content of this handler
-
asCompound
@NotNull @NotNull org.jglrxavpok.hephaistos.nbt.NBTCompound asCompound()Converts the content of this handler into aNBTCompound
.- Returns:
- a nbt compound representation of this handler
-
updateTag
@Experimental <T> void updateTag(@NotNull @NotNull Tag<T> tag, @NotNull @NotNull UnaryOperator<@UnknownNullability T> value) -
updateAndGetTag
@Experimental <T> @UnknownNullability T updateAndGetTag(@NotNull @NotNull Tag<T> tag, @NotNull @NotNull UnaryOperator<@UnknownNullability T> value) -
getAndUpdateTag
@Experimental <T> @UnknownNullability T getAndUpdateTag(@NotNull @NotNull Tag<T> tag, @NotNull @NotNull UnaryOperator<@UnknownNullability T> value) -
newHandler
-
fromCompound
@NotNull static @NotNull TagHandler fromCompound(@NotNull @NotNull org.jglrxavpok.hephaistos.nbt.NBTCompoundLike compound) Copy the content of the givenNBTCompoundLike
into a newTagHandler
.- Parameters:
compound
- the compound to read tags from- Returns:
- a new tag handler with the content of the given compound
-