Package net.minestom.server.tag
Class Tag<T>
java.lang.Object
net.minestom.server.tag.Tag<T>
- Type Parameters:
T
- the tag type
Represents a key to retrieve or change a value.
All tags are serializable.
-
Method Summary
Modifier and TypeMethodDescriptiondefaultValue
(@NotNull Supplier<T> defaultValue) defaultValue
(T defaultValue) boolean
@NotNull String
getKey()
Returns the key used to navigate inside the holder nbt.int
hashCode()
list()
<R> Tag
<R> static @NotNull Tag
<org.jglrxavpok.hephaistos.nbt.NBT> Creates a flexible tag able to read and write anyNBT
objects.read
(@NotNull org.jglrxavpok.hephaistos.nbt.NBTCompoundLike nbt) static <T> @NotNull Tag
<T> Structure
(@NotNull String key, @NotNull TagSerializer<T> serializer) Creates a tag containing multiple fields.static <T> @NotNull Tag
<T> static <T> @NotNull Tag
<T> View
(@NotNull TagSerializer<T> serializer) Specialized Structure tag affecting the src of the handler (i.e.void
void
writeUnsafe
(@NotNull org.jglrxavpok.hephaistos.nbt.mutable.MutableNBTCompound nbtCompound, @Nullable Object value)
-
Method Details
-
getKey
Returns the key used to navigate inside the holder nbt.- Returns:
- the tag key
-
defaultValue
-
defaultValue
-
map
-
list
-
path
-
read
-
write
public void write(@NotNull @NotNull org.jglrxavpok.hephaistos.nbt.mutable.MutableNBTCompound nbtCompound, @Nullable T value) -
writeUnsafe
public void writeUnsafe(@NotNull @NotNull org.jglrxavpok.hephaistos.nbt.mutable.MutableNBTCompound nbtCompound, @Nullable @Nullable Object value) -
equals
-
hashCode
public int hashCode() -
Byte
-
Boolean
-
Short
-
Integer
-
Long
-
Float
-
Double
-
String
-
UUID
-
ItemStack
-
Component
-
NBT
@NotNull public static @NotNull Tag<org.jglrxavpok.hephaistos.nbt.NBT> NBT(@NotNull @NotNull String key) Creates a flexible tag able to read and write anyNBT
objects.Specialized tags are recommended if the type is known as conversion will be required both way (read and write).
-
Structure
@NotNull public static <T> @NotNull Tag<T> Structure(@NotNull @NotNull String key, @NotNull @NotNull TagSerializer<T> serializer) Creates a tag containing multiple fields.Those fields cannot be modified from an outside tag. (This is to prevent the backed object from becoming out of sync)
- Type Parameters:
T
- the tag type- Parameters:
key
- the tag keyserializer
- the tag serializer- Returns:
- the created tag
-
View
Specialized Structure tag affecting the src of the handler (i.e. overwrite all its data).Must be used with care.
-
Structure
-
View
-
Transient
-