@jsprismarine/protocol 0.20.0-unstable-20261110112121 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# @jsprismarine/protocol
|
|
2
2
|
|
|
3
|
-
## 0.20.0
|
|
3
|
+
## 0.20.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- [#2945](https://github.com/JSPrismarine/JSPrismarine/pull/2945) [`7f8040c`](https://github.com/JSPrismarine/JSPrismarine/commit/7f8040c97c2d5b8de33303a9d5cfcf5c2c2c7ba9) Thanks [@filiphsps](https://github.com/filiphsps)! - Move the bodies of the flat packets onto declarative wire layouts. Each class keeps its payload
|
|
8
8
|
shape and writes the same bytes. The layout definitions, such as `animateEntityPacket` and
|
|
9
9
|
`unlockedRecipesPacket`, are now exported from the package.
|
|
10
|
-
- Updated dependencies [[`4871ae6`](https://github.com/JSPrismarine/JSPrismarine/commit/4871ae64bf290095e3af06a7d7e13206d2989d16)]:
|
|
11
|
-
- @jsprismarine/
|
|
12
|
-
- @jsprismarine/
|
|
13
|
-
- @jsprismarine/
|
|
14
|
-
- @jsprismarine/
|
|
15
|
-
- @jsprismarine/
|
|
16
|
-
- @jsprismarine/
|
|
17
|
-
- @jsprismarine/
|
|
18
|
-
- @jsprismarine/
|
|
10
|
+
- Updated dependencies [[`f030c63`](https://github.com/JSPrismarine/JSPrismarine/commit/f030c63e5c6269288d8dc576bddde160eda3cc74), [`4871ae6`](https://github.com/JSPrismarine/JSPrismarine/commit/4871ae64bf290095e3af06a7d7e13206d2989d16)]:
|
|
11
|
+
- @jsprismarine/binaryutils@0.20.0
|
|
12
|
+
- @jsprismarine/minecraft@0.20.0
|
|
13
|
+
- @jsprismarine/math@0.20.0
|
|
14
|
+
- @jsprismarine/nbt@0.20.0
|
|
15
|
+
- @jsprismarine/blocks@0.20.0
|
|
16
|
+
- @jsprismarine/items@0.20.0
|
|
17
|
+
- @jsprismarine/recipes@0.20.0
|
|
18
|
+
- @jsprismarine/content@0.20.0
|
|
19
19
|
|
|
20
20
|
## 0.19.2
|
|
21
21
|
|
|
@@ -27,16 +27,6 @@ export default class NetworkBinaryStream extends BinaryStream {
|
|
|
27
27
|
* @param str - The string to write.
|
|
28
28
|
*/
|
|
29
29
|
writeLELengthASCIIString(str: string): void;
|
|
30
|
-
/**
|
|
31
|
-
* Reads a length-prefixed buffer from the stream.
|
|
32
|
-
* @returns The length-prefixed buffer.
|
|
33
|
-
*/
|
|
34
|
-
readLengthPrefixed(): Buffer;
|
|
35
|
-
/**
|
|
36
|
-
* Writes a length-prefixed buffer to the stream.
|
|
37
|
-
* @param buf - The buffer to append.
|
|
38
|
-
*/
|
|
39
|
-
writeLengthPrefixed(buf: Buffer): void;
|
|
40
30
|
/**
|
|
41
31
|
* Reads a value Cereal bound as `brstd::optional<T>`: a presence boolean, then the value
|
|
42
32
|
* when the boolean is 1.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkBinaryStream.d.ts","sources":["../src/NetworkBinaryStream.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2BAA2B,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,YAAY;IACzD;;;;OAIG;IACI,UAAU,IAAI,MAAM,CAE1B;IAED;;;OAGG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"NetworkBinaryStream.d.ts","sources":["../src/NetworkBinaryStream.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2BAA2B,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,YAAY;IACzD;;;;OAIG;IACI,UAAU,IAAI,MAAM,CAE1B;IAED;;;OAGG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEpC;IAED;;;;;OAKG;IACI,uBAAuB,IAAI,MAAM,CAEvC;IAED;;;OAGG;IACI,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAIjD;IAED;;;;;OAKG;IACI,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAEnD;IAED;;;;;OAKG;IACI,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI,CAK7E;CACJ"}
|
|
@@ -11,15 +11,14 @@ var NetworkBinaryStream = class extends BinaryStream {
|
|
|
11
11
|
* @returns The read string.
|
|
12
12
|
*/
|
|
13
13
|
readString() {
|
|
14
|
-
return this.
|
|
14
|
+
return this.readVarString();
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Writes a string to the stream.
|
|
18
18
|
* @param str - The string to write.
|
|
19
19
|
*/
|
|
20
20
|
writeString(str) {
|
|
21
|
-
this.
|
|
22
|
-
this.writeUTF8String(str);
|
|
21
|
+
this.writeVarString(str);
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* Reads an ASCII string with a little-endian uint32 byte length, the form the
|
|
@@ -40,21 +39,6 @@ var NetworkBinaryStream = class extends BinaryStream {
|
|
|
40
39
|
this.write(buf);
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
|
-
* Reads a length-prefixed buffer from the stream.
|
|
44
|
-
* @returns The length-prefixed buffer.
|
|
45
|
-
*/
|
|
46
|
-
readLengthPrefixed() {
|
|
47
|
-
return this.read(this.readUnsignedVarInt());
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Writes a length-prefixed buffer to the stream.
|
|
51
|
-
* @param buf - The buffer to append.
|
|
52
|
-
*/
|
|
53
|
-
writeLengthPrefixed(buf) {
|
|
54
|
-
this.writeUnsignedVarInt(buf.byteLength);
|
|
55
|
-
this.write(buf);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
42
|
* Reads a value Cereal bound as `brstd::optional<T>`: a presence boolean, then the value
|
|
59
43
|
* when the boolean is 1.
|
|
60
44
|
* @param read - Reads the value once the presence byte says it is there.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkBinaryStream.js","names":[],"sources":["../src/NetworkBinaryStream.ts"],"sourcesContent":["import BinaryStream from '@jsprismarine/binaryutils';\n\n/**\n * Represents an extended version of the BinaryStream class that includes\n * minecraft-specific serialization methods.\n */\nexport default class NetworkBinaryStream extends BinaryStream {\n /**\n * Reads a string from the stream: a varuint32 byte length, then UTF-8 bytes.\n * {@link https://mojang.github.io/bedrock-protocol-docs/1.26.51/primitives/#string | The docs' string primitive}\n * @returns The read string.\n */\n public readString(): string {\n return this.
|
|
1
|
+
{"version":3,"file":"NetworkBinaryStream.js","names":[],"sources":["../src/NetworkBinaryStream.ts"],"sourcesContent":["import BinaryStream from '@jsprismarine/binaryutils';\n\n/**\n * Represents an extended version of the BinaryStream class that includes\n * minecraft-specific serialization methods.\n */\nexport default class NetworkBinaryStream extends BinaryStream {\n /**\n * Reads a string from the stream: a varuint32 byte length, then UTF-8 bytes.\n * {@link https://mojang.github.io/bedrock-protocol-docs/1.26.51/primitives/#string | The docs' string primitive}\n * @returns The read string.\n */\n public readString(): string {\n return this.readVarString();\n }\n\n /**\n * Writes a string to the stream.\n * @param str - The string to write.\n */\n public writeString(str: string): void {\n this.writeVarString(str);\n }\n\n /**\n * Reads an ASCII string with a little-endian uint32 byte length, the form the\n * `LoginPacket` connection request uses for its JWT chain and client data. The docs\n * describe only the varuint32-prefixed string primitive, not this one.\n * @returns The read string.\n */\n public readLELengthASCIIString(): string {\n return this.read(this.readUnsignedIntLE()).toString('ascii');\n }\n\n /**\n * Writes a length-prefixed ASCII string to the stream.\n * @param str - The string to write.\n */\n public writeLELengthASCIIString(str: string): void {\n const buf = Buffer.from(str, 'ascii');\n this.writeUnsignedIntLE(buf.byteLength);\n this.write(buf);\n }\n\n /**\n * Reads a value Cereal bound as `brstd::optional<T>`: a presence boolean, then the value\n * when the boolean is 1.\n * @param read - Reads the value once the presence byte says it is there.\n * @returns The value, or undefined when the presence byte is 0.\n */\n public readOptional<T>(read: () => T): T | undefined {\n return this.readBoolean() ? read() : undefined;\n }\n\n /**\n * Writes a value Cereal bound as `brstd::optional<T>`: a presence boolean, then the value\n * when it is defined.\n * @param value - The value, or undefined to write a single 0 byte.\n * @param write - Writes the value after the presence byte.\n */\n public writeOptional<T>(value: T | undefined, write: (value: T) => void): void {\n this.writeBoolean(value !== undefined);\n if (value !== undefined) {\n write(value);\n }\n }\n}\n"],"mappings":";;;;;;AAMA,IAAqB,sBAArB,cAAiD,aAAa;;;;;;CAM1D,aAA4B;EACxB,OAAO,KAAK,cAAc;CAC9B;;;;;CAMA,YAAmB,KAAmB;EAClC,KAAK,eAAe,GAAG;CAC3B;;;;;;;CAQA,0BAAyC;EACrC,OAAO,KAAK,KAAK,KAAK,kBAAkB,CAAC,CAAC,CAAC,SAAS,OAAO;CAC/D;;;;;CAMA,yBAAgC,KAAmB;EAC/C,MAAM,MAAM,OAAO,KAAK,KAAK,OAAO;EACpC,KAAK,mBAAmB,IAAI,UAAU;EACtC,KAAK,MAAM,GAAG;CAClB;;;;;;;CAQA,aAAuB,MAA8B;EACjD,OAAO,KAAK,YAAY,IAAI,KAAK,IAAI,KAAA;CACzC;;;;;;;CAQA,cAAwB,OAAsB,OAAiC;EAC3E,KAAK,aAAa,UAAU,KAAA,CAAS;EACrC,IAAI,UAAU,KAAA,GACV,MAAM,KAAK;CAEnB;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsprismarine/protocol",
|
|
3
|
-
"version": "0.20.0
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Protocol package used by JSPrismarine packages",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"homepage": "https://github.com/JSPrismarine/JSPrismarine/tree/master/packages/protocol",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@jsprismarine/bedrock-data": "0.20.0
|
|
49
|
-
"@jsprismarine/packs": "0.20.0
|
|
48
|
+
"@jsprismarine/bedrock-data": "0.20.0",
|
|
49
|
+
"@jsprismarine/packs": "0.20.0",
|
|
50
50
|
"@mtcute/wasm": "0.32.8",
|
|
51
51
|
"@types/node": "26.6.6",
|
|
52
52
|
"glob": "14.0.4",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"vitest": "5.1.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@jsprismarine/binaryutils": "0.20.0
|
|
60
|
-
"@jsprismarine/blocks": "0.20.0
|
|
61
|
-
"@jsprismarine/content": "0.20.0
|
|
62
|
-
"@jsprismarine/items": "0.20.0
|
|
63
|
-
"@jsprismarine/math": "0.20.0
|
|
64
|
-
"@jsprismarine/minecraft": "0.20.0
|
|
65
|
-
"@jsprismarine/nbt": "0.20.0
|
|
66
|
-
"@jsprismarine/recipes": "0.20.0
|
|
59
|
+
"@jsprismarine/binaryutils": "0.20.0",
|
|
60
|
+
"@jsprismarine/blocks": "0.20.0",
|
|
61
|
+
"@jsprismarine/content": "0.20.0",
|
|
62
|
+
"@jsprismarine/items": "0.20.0",
|
|
63
|
+
"@jsprismarine/math": "0.20.0",
|
|
64
|
+
"@jsprismarine/minecraft": "0.20.0",
|
|
65
|
+
"@jsprismarine/nbt": "0.20.0",
|
|
66
|
+
"@jsprismarine/recipes": "0.20.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "vite build && node ../../scripts/emit-dts.mts",
|