Package net.minestom.server.tag
Interface TagSerializer<T>
- Type Parameters:
T
- the type to serialize
public interface TagSerializer<T>
Interface used to create custom
tags
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final TagSerializer
<net.kyori.adventure.nbt.CompoundBinaryTag> -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TagSerializer
<T> fromCompound
(@NotNull Function<net.kyori.adventure.nbt.CompoundBinaryTag, T> reader, @NotNull Function<T, net.kyori.adventure.nbt.CompoundBinaryTag> writer) read
(@NotNull TagReadable reader) Reads the custom tag from aTagReadable
.void
write
(@NotNull TagWritable writer, T value) Writes the custom tag to aTagWritable
.
-
Field Details
-
COMPOUND
-
-
Method Details
-
read
Reads the custom tag from aTagReadable
.- Parameters:
reader
- the reader- Returns:
- the deserialized value, null if invalid
-
write
Writes the custom tag to aTagWritable
.- Parameters:
writer
- the writervalue
- the value to serialize
-
fromCompound
@Experimental static <T> TagSerializer<T> fromCompound(@NotNull @NotNull Function<net.kyori.adventure.nbt.CompoundBinaryTag, T> reader, @NotNull @NotNull Function<T, net.kyori.adventure.nbt.CompoundBinaryTag> writer)
-