SerenityJS
    Preparing search index...

    Represents a Minecraft Bedrock Edition data packet

    Hierarchy (View Summary)

    Index

    Constructors

    • Create a new BinaryStream instance.

      Parameters

      • Optionalbuffer: Buffer<ArrayBufferLike>

        The buffer to use for this stream.

      Returns AnimatePacket

    Properties

    boatRowingTime: null | number
    buffer: Buffer

    The buffer that this stream operates on.

    offset: number

    The current offset in the buffer from which to read or write data.

    runtimeEntityId: bigint
    id: Packet

    The packet id.

    id_type: typeof VarInt = VarInt

    The packet id data type.

    Methods

    • Check if the offset is at the end of the buffer.

      Returns boolean

      Whether the offset is at the end.

    • Get the current buffer of the stream.

      Returns Buffer

      The current buffer up to the current offset.

    • Gets the packet id.

      Returns number

      The packet id.

    • Gets the packet id data type.

      Returns typeof DataType

      The packet id data type.

    • Read a specified number of bytes from the stream.

      Parameters

      • length: number

        The number of bytes to read.

      Returns Buffer

      The read bytes as a Buffer.

      The buffer returned is a subarray of the original buffer.

    • Read a boolean value from the stream.

      Returns boolean

      The read boolean value.

    • Read a 32-bit floating point number from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns number

      The read 32-bit float.

    • Read a 16-bit signed integer (i16) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns number

      The read 16-bit signed integer.

    • Read a 24-bit signed integer (i24) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns number

      The read 24-bit signed integer.

    • Read a 32-bit signed integer (i32) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns number

      The read 32-bit signed integer.

    • Read a 64-bit signed integer (i64) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns bigint

      The read 64-bit signed integer.

    • Read a 8-bit signed integer (i8) from the stream.

      Returns number

      The read 8-bit signed integer.

    • Read a 16-bit string from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns string

      The read string.

    • Read a 32-bit string from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns string

      The read string.

    • Read a 16-bit unsigned integer (u16) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns number

      The read 16-bit unsigned integer.

    • Read a 24-bit unsigned integer (u24) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns number

      The read 24-bit unsigned integer.

    • Read a 32-bit unsigned integer (u32) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns number

      The read 32-bit unsigned integer.

    • Read a 64-bit unsigned integer (u64) from the stream.

      Parameters

      • Optionalendian: Endianness

        The endianness to use for reading.

      Returns bigint

      The read 64-bit unsigned integer.

    • Read a 8-bit unsigned integer (u8) from the stream.

      Returns number

      The read 8-bit unsigned integer.

    • Read a variable-length integer (varint) from the stream.

      Returns number

      The read variable-length integer.

    • Read a variable-length long integer (varlong) from the stream.

      Returns bigint

      The read variable-length long integer.

    • Read a variable-length string from the stream.

      Returns string

      The read variable-length string.

    • Read a ZigZag encoded integer from the stream.

      Returns number

      The decoded integer.

    • Read a ZigZong encoded integer from the stream.

      Returns bigint

      The decoded ZigZong integer.

    • Validate if the current offset plus the specified length exceeds the buffer length.

      Parameters

      • length: number

        The length to validate against the current offset.

      Returns boolean

      True if the offset is valid, false otherwise.

    • Write a Buffer to the stream at the current offset.

      Parameters

      • data: Buffer

        The Buffer to write to the stream.

      Returns void

    • Write a boolean value to the stream.

      Parameters

      • value: boolean

        The boolean value to write.

      Returns void

    • Write a 32-bit floating point number to the stream.

      Parameters

      • value: number

        The 32-bit float to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 16-bit signed integer (i16) to the stream.

      Parameters

      • value: number

        The 16-bit signed integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 24-bit signed integer (i24) to the stream.

      Parameters

      • value: number

        The 24-bit signed integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 32-bit signed integer (i32) to the stream.

      Parameters

      • value: number

        The 32-bit signed integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 64-bit signed integer (i64) to the stream.

      Parameters

      • value: bigint

        The 64-bit signed integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 8-bit signed integer (i8) to the stream.

      Parameters

      • value: number

        The 8-bit signed integer to write.

      Returns void

    • Write a 16-bit string to the stream.

      Parameters

      • value: string

        The string to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 32-bit string to the stream.

      Parameters

      • value: string

        The string to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 16-bit unsigned integer (u16) to the stream.

      Parameters

      • value: number

        The 16-bit unsigned integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 24-bit unsigned integer (u24) to the stream.

      Parameters

      • value: number

        The 24-bit unsigned integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 32-bit unsigned integer (u32) to the stream.

      Parameters

      • value: number

        The 32-bit unsigned integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 64-bit unsigned integer (u64) to the stream.

      Parameters

      • value: bigint

        The 64-bit unsigned integer to write.

      • Optionalendian: Endianness

        The endianness to use for writing.

      Returns void

    • Write a 8-bit unsigned integer (u8) to the stream.

      Parameters

      • value: number

        The 8-bit unsigned integer to write.

      Returns void

    • Write a variable-length integer (varint) to the stream.

      Parameters

      • value: number

        The variable-length integer to write.

      Returns void

    • Write a variable-length long integer (varlong) to the stream.

      Parameters

      • value: bigint

        The variable-length long integer to write.

      Returns void

    • Write a variable-length string to the stream.

      Parameters

      • value: string

        The string to write.

      Returns void

    • Write a ZigZag encoded integer to the stream.

      Parameters

      • value: number

        The integer to encode and write.

      Returns void

    • Write a ZigZong encoded integer to the stream.

      Parameters

      • value: bigint

        The ZigZong integer to encode and write.

      Returns void