Class ArgumentSerializerRegistry
Namespace: Void.Minecraft.Commands.Brigadier.Registry
Assembly: Void.Minecraft.dll
Registers command argument serializers and resolves their protocol identifiers.
public class ArgumentSerializerRegistryInheritance
object ← ArgumentSerializerRegistry
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
DecodeParserMapping(ref BufferSpan, ProtocolVersion)
Reads and resolves a numeric or string parser identifier.
public static ArgumentSerializerMapping DecodeParserMapping(ref BufferSpan buffer, ProtocolVersion protocolVersion)Parameters
buffer BufferSpan
The source buffer.
protocolVersion ProtocolVersion
The source protocol version.
Returns
The registered mapping.
Exceptions
The identifier is unknown for the protocol version.
Deserialize(ref BufferSpan, ProtocolVersion)
Reads a parser identifier and its properties.
public static IArgumentType Deserialize(ref BufferSpan buffer, ProtocolVersion protocolVersion)Parameters
buffer BufferSpan
The source command-tree buffer.
protocolVersion ProtocolVersion
The source protocol version.
Returns
A normal argument type or a wrapped passthrough argument.
Exceptions
The decoded mapping is not registered.
Register(ArgumentSerializerMapping, IArgumentSerializer?)
Registers a passthrough mapping without associating a normal runtime argument type.
public static void Register(ArgumentSerializerMapping mapping, IArgumentSerializer? serializer = null)Parameters
mapping ArgumentSerializerMapping
The protocol identifier mapping.
serializer IArgumentSerializer?
The payload serializer, or the empty serializer when null.
Register(ArgumentSerializerMapping, Type?, IArgumentSerializer)
Registers or replaces mapping and optional runtime-type associations.
public static void Register(ArgumentSerializerMapping mapping, Type? argumentType, IArgumentSerializer serializer)Parameters
mapping ArgumentSerializerMapping
The protocol identifier mapping.
argumentType Type?
The normal argument runtime type, or null for passthrough-only use.
serializer IArgumentSerializer
The property serializer.
Serialize(ref BufferSpan, IArgumentType, ProtocolVersion)
Writes an argument parser identifier and its properties.
public static void Serialize(ref BufferSpan buffer, IArgumentType argumentType, ProtocolVersion protocolVersion)Parameters
buffer BufferSpan
The destination command-tree buffer.
argumentType IArgumentType
The normal or passthrough argument type.
protocolVersion ProtocolVersion
The target protocol version.
Exceptions
The runtime argument type is unregistered or has no parser ID for the target version.
WriteParserIdentifier(ref BufferSpan, ArgumentSerializerMapping, ProtocolVersion)
Writes a numeric parser ID for 1.19 and newer, or a string identifier for older protocols.
public static void WriteParserIdentifier(ref BufferSpan buffer, ArgumentSerializerMapping mapping, ProtocolVersion protocolVersion)Parameters
buffer BufferSpan
The destination buffer.
mapping ArgumentSerializerMapping
The parser mapping.
protocolVersion ProtocolVersion
The target protocol version.
Exceptions
No numeric ID exists for a target version requiring one.