diff --git a/packages/nbt/src/types/byte-list.ts b/packages/nbt/src/types/byte-list.ts index 3ceebd6f..ecc616e6 100644 --- a/packages/nbt/src/types/byte-list.ts +++ b/packages/nbt/src/types/byte-list.ts @@ -16,7 +16,9 @@ class ByteListTag extends Array implements BaseTag { * @param name The name of the tag, defaults to null. */ public constructor(elements: Array, name?: string | null) { - super(...elements); + // Push the elements, so a single element is not treated as a length. + super(); + this.push(...elements); this.name = name ?? null; } @@ -46,10 +48,10 @@ class ByteListTag extends Array implements BaseTag { const type: TagType = stream.readInt8(); // Verify that the tag type matches the expected type. - if (type !== TagType.Byte) { + if (type !== TagType.ByteList) { // Throw an error if the type does not match. throw new Error( - `Expected tag type to be ${TagType[TagType.Byte]}, received ${TagType[type] ?? type}.` + `Expected tag type to be ${TagType[TagType.ByteList]}, received ${TagType[type] ?? type}.` ); } }