@ParametersAreNonnullByDefault
public class TextComponentCodec
extends java.lang.Object
TextComponentSerializer class because components can now be serialized to nbt.asSerializer() method. The fields in TextComponentSerializer will still be updated using this wrapper method.| Modifier and Type | Field and Description |
|---|---|
static TextComponentCodec |
LATEST
The latest text codec.
|
static TextComponentCodec |
V1_20_3
The text codec for 1.20.3.
|
| Constructor and Description |
|---|
TextComponentCodec(java.util.function.Supplier<net.lenni0451.mcstructs.snbt.SNbtSerializer<net.lenni0451.mcstructs.nbt.tags.CompoundTag>> sNbtSerializerSupplier,
java.util.function.BiFunction<TextComponentCodec,net.lenni0451.mcstructs.snbt.SNbtSerializer<net.lenni0451.mcstructs.nbt.tags.CompoundTag>,ITypedSerializer<com.google.gson.JsonElement,ATextComponent>> jsonSerializerSupplier,
java.util.function.BiFunction<TextComponentCodec,net.lenni0451.mcstructs.snbt.SNbtSerializer<net.lenni0451.mcstructs.nbt.tags.CompoundTag>,ITypedSerializer<net.lenni0451.mcstructs.nbt.INbtTag,ATextComponent>> nbtSerializerSupplier) |
| Modifier and Type | Method and Description |
|---|---|
TextComponentSerializer |
asSerializer() |
ATextComponent |
deserialize(net.lenni0451.mcstructs.nbt.INbtTag nbt)
Deserialize a text component from a
INbtTag. |
ATextComponent |
deserialize(com.google.gson.JsonElement json)
Deserialize a text component from a
JsonElement. |
ATextComponent |
deserializeJson(java.lang.String json)
Deserialize a text component from a json string.
|
ATextComponent |
deserializeJsonReader(java.lang.String json)
Deserialize a text component from a json string.
|
ATextComponent |
deserializeJsonTree(com.google.gson.JsonElement element)
Deserialize a text component from a
JsonElement. |
ATextComponent |
deserializeLenientJson(java.lang.String json)
Deserialize a text component from a json string.
|
ATextComponent |
deserializeNbt(java.lang.String nbt)
Deserialize a text component from a nbt string.
|
ATextComponent |
deserializeNbtTree(net.lenni0451.mcstructs.nbt.INbtTag nbt)
Deserialize a text component from a
INbtTag. |
ITypedSerializer<com.google.gson.JsonElement,ATextComponent> |
getJsonSerializer() |
ITypedSerializer<net.lenni0451.mcstructs.nbt.INbtTag,ATextComponent> |
getNbtSerializer() |
java.lang.String |
serializeJsonString(ATextComponent component)
Serialize a text component to a json string.
|
com.google.gson.JsonElement |
serializeJsonTree(ATextComponent component)
Serialize a text component to a
JsonElement. |
net.lenni0451.mcstructs.nbt.INbtTag |
serializeNbt(ATextComponent component)
Serialize a text component to a
INbtTag. |
java.lang.String |
serializeNbtString(ATextComponent component)
Serialize a text component to a nbt string.
|
public static final TextComponentCodec V1_20_3
public static final TextComponentCodec LATEST
public TextComponentCodec(java.util.function.Supplier<net.lenni0451.mcstructs.snbt.SNbtSerializer<net.lenni0451.mcstructs.nbt.tags.CompoundTag>> sNbtSerializerSupplier,
java.util.function.BiFunction<TextComponentCodec,net.lenni0451.mcstructs.snbt.SNbtSerializer<net.lenni0451.mcstructs.nbt.tags.CompoundTag>,ITypedSerializer<com.google.gson.JsonElement,ATextComponent>> jsonSerializerSupplier,
java.util.function.BiFunction<TextComponentCodec,net.lenni0451.mcstructs.snbt.SNbtSerializer<net.lenni0451.mcstructs.nbt.tags.CompoundTag>,ITypedSerializer<net.lenni0451.mcstructs.nbt.INbtTag,ATextComponent>> nbtSerializerSupplier)
public ITypedSerializer<com.google.gson.JsonElement,ATextComponent> getJsonSerializer()
public ITypedSerializer<net.lenni0451.mcstructs.nbt.INbtTag,ATextComponent> getNbtSerializer()
public ATextComponent deserializeJson(java.lang.String json)
json - The json stringpublic ATextComponent deserializeJsonReader(java.lang.String json)
JsonReader will be used to parse the json string.json - The json stringpublic ATextComponent deserializeLenientJson(java.lang.String json)
JsonReader will be used to parse the json string.json - The json stringpublic ATextComponent deserializeNbt(java.lang.String nbt)
nbt - The nbt stringpublic ATextComponent deserializeJsonTree(@Nullable com.google.gson.JsonElement element)
JsonElement.element - The json elementpublic ATextComponent deserializeNbtTree(@Nullable net.lenni0451.mcstructs.nbt.INbtTag nbt)
INbtTag.nbt - The nbt tagpublic ATextComponent deserialize(com.google.gson.JsonElement json)
JsonElement.json - The json elementpublic ATextComponent deserialize(net.lenni0451.mcstructs.nbt.INbtTag nbt)
INbtTag.nbt - The nbt tagpublic com.google.gson.JsonElement serializeJsonTree(ATextComponent component)
JsonElement.component - The text componentpublic net.lenni0451.mcstructs.nbt.INbtTag serializeNbt(ATextComponent component)
INbtTag.component - The text componentpublic java.lang.String serializeJsonString(ATextComponent component)
component - The text componentpublic java.lang.String serializeNbtString(ATextComponent component)
component - The text componentpublic TextComponentSerializer asSerializer()
TextComponentSerializer.