Class ComponentJsonTransformers
Namespace: Void.Minecraft.Components.Text.Transformers
Assembly: Void.Minecraft.dll
Applies version-specific schema migrations to JSON text components.
public static class ComponentJsonTransformersInheritance
object ← ComponentJsonTransformers
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
Apply(IMinecraftBinaryPacketWrapper, ProtocolVersion, ProtocolVersion)
Transforms the next wrapper between two protocol versions.
public static void Apply(IMinecraftBinaryPacketWrapper wrapper, ProtocolVersion from, ProtocolVersion to)Parameters
wrapper IMinecraftBinaryPacketWrapper
The packet wrapper containing the component property to transform.
from ProtocolVersion
The source protocol version.
The destination protocol version.
Remarks
The method reads the current value from wrapper, applies the JSON component migration rules for from and to, and writes the transformed value back to the same wrapper.
If the payload is not valid component JSON, it is written back unchanged.
Apply(StringProperty, ProtocolVersion, ProtocolVersion)
Transforms the JSON string contained in a packet string property.
public static StringProperty Apply(StringProperty property, ProtocolVersion from, ProtocolVersion to)Parameters
property StringProperty
The property to transform.
from ProtocolVersion
The source protocol version.
The destination protocol version.
Returns
A property containing the transformed JSON, or the original string when it cannot be parsed.
Apply(string, ProtocolVersion, ProtocolVersion)
Transforms a JSON component string between protocol versions.
public static string Apply(string value, ProtocolVersion from, ProtocolVersion to)Parameters
value string
The JSON component string.
from ProtocolVersion
The source protocol version.
The destination protocol version.
Returns
The transformed compact JSON, or value unchanged when parsing fails.
Apply(JsonNode, ProtocolVersion, ProtocolVersion)
Applies every component-schema transition crossed by a protocol-version change.
public static JsonNode Apply(JsonNode node, ProtocolVersion from, ProtocolVersion to)Parameters
node JsonNode
The component node. Object graphs may be mutated in place.
from ProtocolVersion
The source protocol version.
The destination protocol version.
Returns
The migrated node, or the original node when it is not a JSON object.
Downgrade_v1_12_to_v1_11_1(JsonNode)
Restores marked achievement hover events when downgrading from 1.12 to 1.11.1.
public static JsonNode Downgrade_v1_12_to_v1_11_1(JsonNode node)Parameters
node JsonNode
The component node to mutate recursively.
Returns
The migrated node.
Downgrade_v1_16_to_v1_15_2(JsonNode)
Downgrades 1.16 colors and hover-event contents to the 1.15.2 JSON schema.
public static JsonNode Downgrade_v1_16_to_v1_15_2(JsonNode node)Parameters
node JsonNode
The component node to mutate recursively.
Returns
The migrated node; compact strings are expanded to text objects.
Downgrade_v1_9_to_v1_8(JsonNode)
Converts structured legacy hover values to scalar values for the 1.8 JSON schema.
public static JsonNode Downgrade_v1_9_to_v1_8(JsonNode node)Parameters
node JsonNode
The component node to mutate recursively.
Returns
The migrated node.
Exceptions
A structured supported hover action has no text value.
Passthrough_v1_11_1_to_v1_12(IMinecraftBinaryPacketWrapper)
Reads, upgrades, and rewrites one JSON component property from 1.11.1 to 1.12 format.
public static void Passthrough_v1_11_1_to_v1_12(IMinecraftBinaryPacketWrapper wrapper)Parameters
wrapper IMinecraftBinaryPacketWrapper
The packet wrapper whose cursor is advanced by one property.
Passthrough_v1_12_to_v1_11_1(IMinecraftBinaryPacketWrapper)
Reads, downgrades, and rewrites one JSON component property from 1.12 to 1.11.1 format.
public static void Passthrough_v1_12_to_v1_11_1(IMinecraftBinaryPacketWrapper wrapper)Parameters
wrapper IMinecraftBinaryPacketWrapper
The packet wrapper whose cursor is advanced by one property.
Passthrough_v1_15_2_to_v1_16(IMinecraftBinaryPacketWrapper)
Reads, upgrades, and rewrites one JSON component property from 1.15.2 to 1.16 format.
public static void Passthrough_v1_15_2_to_v1_16(IMinecraftBinaryPacketWrapper wrapper)Parameters
wrapper IMinecraftBinaryPacketWrapper
The packet wrapper whose cursor is advanced by one property.
Passthrough_v1_16_to_v1_15_2(IMinecraftBinaryPacketWrapper)
Reads, downgrades, and rewrites one JSON component property from 1.16 to 1.15.2 format.
public static void Passthrough_v1_16_to_v1_15_2(IMinecraftBinaryPacketWrapper wrapper)Parameters
wrapper IMinecraftBinaryPacketWrapper
The packet wrapper whose cursor is advanced by one property.
Passthrough_v1_8_to_v1_9(IMinecraftBinaryPacketWrapper)
Reads, upgrades, and rewrites one JSON component property from 1.8 to 1.9 format.
public static void Passthrough_v1_8_to_v1_9(IMinecraftBinaryPacketWrapper wrapper)Parameters
wrapper IMinecraftBinaryPacketWrapper
The packet wrapper whose cursor is advanced by one property.
Passthrough_v1_9_to_v1_8(IMinecraftBinaryPacketWrapper)
Reads, downgrades, and rewrites one JSON component property from 1.9 to 1.8 format.
public static void Passthrough_v1_9_to_v1_8(IMinecraftBinaryPacketWrapper wrapper)Parameters
wrapper IMinecraftBinaryPacketWrapper
The packet wrapper whose cursor is advanced by one property.
Upgrade_v1_11_1_to_v1_12(JsonNode)
Converts achievement hover events to marked text hover events for 1.12.
public static JsonNode Upgrade_v1_11_1_to_v1_12(JsonNode node)Parameters
node JsonNode
The component node to mutate recursively.
Returns
The migrated node.
Upgrade_v1_15_2_to_v1_16(JsonNode)
Upgrades hover values and compact strings to the 1.16 JSON schema.
public static JsonNode Upgrade_v1_15_2_to_v1_16(JsonNode node)Parameters
node JsonNode
The component node to mutate recursively.
Returns
The migrated node.
Exceptions
An item or entity hover value has no SNBT text field.
Upgrade_v1_8_to_v1_9(JsonNode)
Wraps supported scalar hover values in text objects for the 1.9 JSON schema.
public static JsonNode Upgrade_v1_8_to_v1_9(JsonNode node)Parameters
node JsonNode
The component node to mutate recursively.
Returns
The migrated node.