Package net.kyori.adventure.nbt.api
Interface BinaryTagHolder
- All Superinterfaces:
DataComponentValue
,DataComponentValue.TagSerializable
,net.kyori.examination.Examinable
Holds a compound binary tag.
Instead of including an entire NBT implementation in Adventure, it was decided to use this "holder" interface instead. This opens the door for platform specific implementations.
See net.kyori.adventure.nbt.impl
for a platform agnostic implementation.
- Since:
- 4.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.text.event.DataComponentValue
DataComponentValue.Removed, DataComponentValue.TagSerializable
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull BinaryTagHolder
Convert this value into a binary tag value.static @NotNull BinaryTagHolder
binaryTagHolder
(@NotNull String string) Creates an encoded binary tag holder.static <T,
EX extends Exception>
@NotNull BinaryTagHolderEncodesnbt
usingcodec
.<T,
DX extends Exception>
TGets the held value as a binary tag.static @NotNull BinaryTagHolder
Deprecated.@NotNull String
string()
Gets the raw string value.Methods inherited from interface net.kyori.examination.Examinable
examinableName, examinableProperties, examine
-
Method Details
-
encode
@NotNull static <T,EX extends Exception> @NotNull BinaryTagHolder encode(@NotNull T nbt, @NotNull @NotNull Codec<? super T, String, throws EX?, EX> codec) Encodesnbt
usingcodec
.- Type Parameters:
T
- the binary tag typeEX
- encode exception type- Parameters:
nbt
- the binary tagcodec
- the codec- Returns:
- the encoded binary tag holder
- Throws:
EX
- if an error occurred while encoding the binary tag- Since:
- 4.0.0
-
binaryTagHolder
Creates an encoded binary tag holder.- Parameters:
string
- the encoded binary tag value- Returns:
- the encoded binary tag
- Since:
- 4.10.0
-
of
@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull static @NotNull BinaryTagHolder of(@NotNull @NotNull String string) Deprecated.for removal since 4.10.0, usebinaryTagHolder(String)
instead.Creates an encoded binary tag holder.- Parameters:
string
- the encoded binary tag value- Returns:
- the encoded binary tag
- Since:
- 4.0.0
-
string
Gets the raw string value.- Returns:
- the raw string value
- Since:
- 4.0.0
-
asBinaryTag
Description copied from interface:DataComponentValue.TagSerializable
Convert this value into a binary tag value.- Specified by:
asBinaryTag
in interfaceDataComponentValue.TagSerializable
- Returns:
- the binary tag value
-
get
Gets the held value as a binary tag.- Type Parameters:
T
- the binary tag typeDX
- decode thrown exception type- Parameters:
codec
- the codec- Returns:
- the binary tag
- Throws:
DX
- if an error occurred while retrieving the binary tag- Since:
- 4.0.0
-
binaryTagHolder(String)
instead.