Skip to content

Class WriteMinecraftBufferExtensions

Namespace: Void.Minecraft.Buffers.Extensions
Assembly: Void.Minecraft.dll

public static class WriteMinecraftBufferExtensions

Inheritance

objectWriteMinecraftBufferExtensions

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Methods

Write<TBuffer>(ref TBuffer, scoped ReadOnlySpan<byte>)

Writes a byte span to a buffer, allowing for efficient data handling in a structured format.

public static void Write<TBuffer>(this ref TBuffer buffer, scoped ReadOnlySpan<byte> data) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer that will receive the byte data.

data ReadOnlySpan<byte>

This parameter contains the byte data that will be copied into the buffer.

Type Parameters

TBuffer

This type parameter represents a struct that implements a specific buffer interface for Minecraft data operations.

Write<TBuffer>(ref TBuffer, Stream)

Writes data from a stream to a specified buffer. Requires the stream to support length property.

public static void Write<TBuffer>(this ref TBuffer buffer, Stream value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is a reference to the structure that will receive the data from the stream.

value Stream

The stream provides the data source that will be written into the buffer.

Type Parameters

TBuffer

The type parameter represents a structure that can be used as a buffer for writing data.

WriteBoolean<TBuffer>(ref TBuffer, bool)

Writes a boolean value to a specified buffer by converting it to a byte.

public static void WriteBoolean<TBuffer>(this ref TBuffer buffer, bool value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is the destination where the boolean value will be written.

value bool

The boolean value to be converted to a byte and written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for writing data.

WriteByteArray<TBuffer>(ref TBuffer, scoped ReadOnlySpan<byte>)

public static void WriteByteArray<TBuffer>(this ref TBuffer buffer, scoped ReadOnlySpan<byte> data) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

data ReadOnlySpan<byte>

Type Parameters

TBuffer

WriteComponent<TBuffer>(ref TBuffer, Component)

Writes a component to a specified buffer using a given protocol version.

public static void WriteComponent<TBuffer>(this ref TBuffer buffer, Component value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer where the component will be written.

value Component

This parameter represents the component that will be written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for Minecraft data handling.

WriteDouble<TBuffer>(ref TBuffer, double)

Writes a double value to a specified buffer in big-endian format.

public static void WriteDouble<TBuffer>(this ref TBuffer buffer, double value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer where the double value will be written.

value double

This parameter is the double value that will be written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for writing data.

WriteFloat<TBuffer>(ref TBuffer, float)

Writes a floating-point number in big-endian format to a specified buffer.

public static void WriteFloat<TBuffer>(this ref TBuffer buffer, float value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is modified to store the floating-point value in a specific format.

value float

The floating-point number to be written into the buffer.

Type Parameters

TBuffer

This type is a structure that implements a specific buffer interface for writing data.

WriteInt<TBuffer>(ref TBuffer, int)

Writes a 32-bit integer to a specified buffer in big-endian format.

public static void WriteInt<TBuffer>(this ref TBuffer buffer, int value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is modified to include the new integer value at the appropriate position.

value int

The integer to be written into the buffer in big-endian format.

Type Parameters

TBuffer

This type is a struct that implements a specific buffer interface, allowing for efficient memory access.

WriteIntArray<TBuffer>(ref TBuffer, scoped ReadOnlySpan<int>)

Writes a sequence of 32-bit integers to the specified Minecraft buffer.

public static void WriteIntArray<TBuffer>(this ref TBuffer buffer, scoped ReadOnlySpan<int> data) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

A reference to the buffer to which the integer array will be written.

data ReadOnlySpan<int>

A read-only span containing the integers to write to the buffer.

Type Parameters

TBuffer

The type of the buffer that implements the IMinecraftBuffer interface.

Remarks

Use this method to efficiently serialize an array of integers into a buffer that conforms to the IMinecraftBuffer interface. The method is intended for use with value-type buffers and supports efficient, allocation-free writing.

WriteLong<TBuffer>(ref TBuffer, long)

Writes a 64-bit integer to a specified buffer in big-endian format.

public static void WriteLong<TBuffer>(this ref TBuffer buffer, long value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is modified to accommodate the new data being written.

value long

The 64-bit integer to be written into the buffer.

Type Parameters

TBuffer

This type is a struct that implements a specific buffer interface for writing data.

WriteProperty<TBuffer>(ref TBuffer, Property)

Writes a property to a specified buffer.

public static void WriteProperty<TBuffer>(this ref TBuffer buffer, Property value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer where the property will be written.

value Property

This parameter represents the property that is to be written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for Minecraft data handling.

WritePropertyArray<TBuffer>(ref TBuffer, Property[]?)

Writes an array of properties to a specified buffer.

public static void WritePropertyArray<TBuffer>(this ref TBuffer buffer, Property[]? value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer to which the array of properties will be written.

value Property[]?

The array of properties that will be written to the buffer.

Type Parameters

TBuffer

This type is a structure that implements a specific buffer interface for Minecraft data handling.

WriteShort<TBuffer>(ref TBuffer, short)

Writes a short integer to a specified buffer in big-endian format.

public static void WriteShort<TBuffer>(this ref TBuffer buffer, short value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer where the short integer will be written.

value short

This parameter is the short integer value to be written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface.

WriteString<TBuffer>(ref TBuffer, ReadOnlySpan<char>)

Writes a string to a specified buffer.

public static void WriteString<TBuffer>(this ref TBuffer buffer, ReadOnlySpan<char> value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer where the string will be written.

value ReadOnlySpan<char>

The characters that will be written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for Minecraft.

WriteTag<TBuffer>(ref TBuffer, NbtTag, bool)

Writes a tag to a specified buffer using a stream representation of the tag.

public static void WriteTag<TBuffer>(this ref TBuffer buffer, NbtTag value, bool writeName = true) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer where the tag will be written.

value NbtTag

This parameter represents the tag that will be converted to a stream and written to the buffer.

writeName bool

This parameter indicates whether the name of the tag should be included when writing to the buffer. Default is true.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for Minecraft data handling.

WriteUnsignedByte<TBuffer>(ref TBuffer, byte)

Writes a single byte value to a specified buffer.

public static void WriteUnsignedByte<TBuffer>(this ref TBuffer buffer, byte value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is modified to store the byte value at a designated position.

value byte

The byte value to be written into the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface.

WriteUnsignedShort<TBuffer>(ref TBuffer, ushort)

Writes an unsigned short value to a specified buffer in big-endian format.

public static void WriteUnsignedShort<TBuffer>(this ref TBuffer buffer, ushort value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

This parameter is a reference to the buffer where the unsigned short value will be written.

value ushort

This parameter is the unsigned short value that will be written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for writing operations.

WriteUuid<TBuffer>(ref TBuffer, Uuid)

Writes a UUID value to a specified buffer in a Minecraft-compatible format.

public static void WriteUuid<TBuffer>(this ref TBuffer buffer, Uuid value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is the destination where the UUID will be written.

value Uuid

The UUID value to be converted and written to the buffer.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for Minecraft data handling.

WriteUuidAsIntArray<TBuffer>(ref TBuffer, Uuid)

Writes a UUID as an integer array into a specified buffer.

public static void WriteUuidAsIntArray<TBuffer>(this ref TBuffer buffer, Uuid value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is modified to include the integer representation of the UUID.

value Uuid

The UUID is converted and written into the buffer as an array of integers.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for Minecraft.

WriteVarInt<TBuffer>(ref TBuffer, int)

Writes a variable-length integer to a specified buffer.

public static void WriteVarInt<TBuffer>(this ref TBuffer buffer, int value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is the destination where the variable-length integer will be written.

value int

The integer value to be written to the buffer in a variable-length format.

Type Parameters

TBuffer

This type parameter represents a structure that implements a specific buffer interface for Minecraft data handling.

WriteVarIntArray<TBuffer>(ref TBuffer, scoped ReadOnlySpan<int>)

Writes a sequence of variable-length integers to the specified buffer.

public static void WriteVarIntArray<TBuffer>(this ref TBuffer buffer, scoped ReadOnlySpan<int> data) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

A reference to the buffer to which the variable-length integers will be written.

data ReadOnlySpan<int>

A read-only span containing the integers to write as variable-length values.

Type Parameters

TBuffer

The type of the buffer that implements the IMinecraftBuffer interface.

Remarks

This method is intended for use with buffers that implement the IMinecraftBuffer interface, enabling efficient serialization of integer arrays in variable-length format.

WriteVarLong<TBuffer>(ref TBuffer, long)

Writes a variable-length long integer to a buffer.

public static void WriteVarLong<TBuffer>(this ref TBuffer buffer, long value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer to which the variable-length long integer will be written.

value long

The long integer value that will be written to the buffer.

Type Parameters

TBuffer

This type is a struct that implements a specific buffer interface for Minecraft data handling.

WriteVarShort<TBuffer>(ref TBuffer, int)

Writes a variable-length short integer to the specified buffer.

public static void WriteVarShort<TBuffer>(this ref TBuffer buffer, int value) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref struct

Parameters

buffer TBuffer

The buffer is the destination where the variable-length short integer will be written.

value int

The integer value to be written to the buffer in a variable-length format.

Type Parameters

TBuffer

This type is a struct that implements a specific buffer interface for Minecraft data handling.