@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 | Description |
|---|---|---|
static TextComponentCodec |
LATEST |
The latest text codec.
|
static TextComponentCodec |
V1_20_3 |
The text codec for 1.20.3.
|
static TextComponentCodec |
V1_20_5 |
The text codec for 1.20.5.
|
static TextComponentCodec |
V1_21_2 |
The text codec for 1.21.2.
|
static TextComponentCodec |
V1_21_4 |
The text codec for 1.21.4.
|
static TextComponentCodec |
V1_21_5 |
The text codec for 1.21.5.
|
static TextComponentCodec |
V1_21_6 |
The text codec for 1.21.6.
|
static TextComponentCodec |
V1_21_9 |
The text codec for 1.21.9.
|
| Constructor | Description |
|---|---|
TextComponentCodec(java.util.function.Supplier<net.lenni0451.mcstructs.snbt.SNbt<net.lenni0451.mcstructs.nbt.tags.CompoundTag>> sNbtSupplier,
java.util.function.Supplier<net.lenni0451.mcstructs.converter.codec.Codec<TextComponent>> textCodec,
java.util.function.Supplier<net.lenni0451.mcstructs.converter.codec.Codec<Style>> styleCodec,
net.lenni0451.mcstructs.converter.DataConverter<com.google.gson.JsonElement> jsonConverter,
net.lenni0451.mcstructs.converter.DataConverter<net.lenni0451.mcstructs.nbt.NbtTag> nbtConverter) |
| Modifier and Type | Method | Description |
|---|---|---|
TextComponentSerializer |
asSerializer() |
|
TextComponent |
deserialize(com.google.gson.JsonElement json) |
Deserialize a text component from a
JsonElement. |
TextComponent |
deserialize(net.lenni0451.mcstructs.nbt.NbtTag nbt) |
Deserialize a text component from a
NbtTag. |
TextComponent |
deserializeJson(java.lang.String json) |
Deserialize a text component from a json string.
|
TextComponent |
deserializeJsonReader(java.lang.String json) |
Deserialize a text component from a json string.
|
TextComponent |
deserializeJsonTree(com.google.gson.JsonElement element) |
Deserialize a text component from a
JsonElement. |
TextComponent |
deserializeLenientJson(java.lang.String json) |
Deserialize a text component from a json string.
|
TextComponent |
deserializeNbt(java.lang.String nbt) |
Deserialize a text component from a nbt string.
|
TextComponent |
deserializeNbtTree(net.lenni0451.mcstructs.nbt.NbtTag nbt) |
Deserialize a text component from a
NbtTag. |
net.lenni0451.mcstructs.converter.DataConverter<com.google.gson.JsonElement> |
getJsonConverter() |
|
net.lenni0451.mcstructs.converter.DataConverter<net.lenni0451.mcstructs.nbt.NbtTag> |
getNbtConverter() |
|
net.lenni0451.mcstructs.converter.codec.Codec<Style> |
getStyleCodec() |
|
net.lenni0451.mcstructs.converter.codec.Codec<TextComponent> |
getTextCodec() |
|
java.lang.String |
serializeJsonString(TextComponent component) |
Serialize a text component to a json string.
|
com.google.gson.JsonElement |
serializeJsonTree(TextComponent component) |
Serialize a text component to a
JsonElement. |
java.lang.String |
serializeNbtString(TextComponent component) |
Serialize a text component to a nbt string.
|
net.lenni0451.mcstructs.nbt.NbtTag |
serializeNbtTree(TextComponent component) |
Serialize a text component to a
NbtTag. |
TextComponentCodec |
withVerifier(TextVerifier verifier) |
Create a new text component codec with the given text verifier.
|
public static final TextComponentCodec V1_20_3
public static final TextComponentCodec V1_20_5
public static final TextComponentCodec V1_21_2
public static final TextComponentCodec V1_21_4
public static final TextComponentCodec V1_21_5
public static final TextComponentCodec V1_21_6
public static final TextComponentCodec V1_21_9
public static final TextComponentCodec LATEST
public TextComponentCodec(java.util.function.Supplier<net.lenni0451.mcstructs.snbt.SNbt<net.lenni0451.mcstructs.nbt.tags.CompoundTag>> sNbtSupplier,
java.util.function.Supplier<net.lenni0451.mcstructs.converter.codec.Codec<TextComponent>> textCodec,
java.util.function.Supplier<net.lenni0451.mcstructs.converter.codec.Codec<Style>> styleCodec,
net.lenni0451.mcstructs.converter.DataConverter<com.google.gson.JsonElement> jsonConverter,
net.lenni0451.mcstructs.converter.DataConverter<net.lenni0451.mcstructs.nbt.NbtTag> nbtConverter)
public net.lenni0451.mcstructs.converter.codec.Codec<TextComponent> getTextCodec()
public net.lenni0451.mcstructs.converter.codec.Codec<Style> getStyleCodec()
public net.lenni0451.mcstructs.converter.DataConverter<com.google.gson.JsonElement> getJsonConverter()
public net.lenni0451.mcstructs.converter.DataConverter<net.lenni0451.mcstructs.nbt.NbtTag> getNbtConverter()
public TextComponentCodec withVerifier(TextVerifier verifier)
verifier - The text verifierpublic TextComponent deserializeJson(java.lang.String json)
json - The json stringpublic TextComponent deserializeJsonReader(java.lang.String json)
JsonReader will be used to parse the json string.json - The json stringpublic TextComponent deserializeLenientJson(java.lang.String json)
JsonReader will be used to parse the json string.json - The json stringpublic TextComponent deserializeNbt(java.lang.String nbt)
nbt - The nbt stringpublic TextComponent deserializeJsonTree(@Nullable com.google.gson.JsonElement element)
JsonElement.element - The json elementpublic TextComponent deserializeNbtTree(@Nullable net.lenni0451.mcstructs.nbt.NbtTag nbt)
NbtTag.nbt - The nbt tagpublic TextComponent deserialize(com.google.gson.JsonElement json)
JsonElement.json - The json elementpublic TextComponent deserialize(net.lenni0451.mcstructs.nbt.NbtTag nbt)
NbtTag.nbt - The nbt tagpublic com.google.gson.JsonElement serializeJsonTree(TextComponent component)
JsonElement.component - The text componentpublic net.lenni0451.mcstructs.nbt.NbtTag serializeNbtTree(TextComponent component)
NbtTag.component - The text componentpublic java.lang.String serializeJsonString(TextComponent component)
component - The text componentpublic java.lang.String serializeNbtString(TextComponent component)
component - The text componentpublic TextComponentSerializer asSerializer()
TextComponentSerializer.