bedrock-portal-nethernet 2.7.0 → 2.8.1
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/dist/datatypes/compiler-minecraft.js +62 -0
- package/dist/options.d.ts +1 -1
- package/dist/options.js +2 -2
- package/dist/protocol.d.ts +401 -315
- package/dist/protocol.js +1049 -800
- package/package.json +1 -1
|
@@ -34,6 +34,68 @@ Write.restBuffer = ['native', (value, buffer, offset) => {
|
|
|
34
34
|
SizeOf.restBuffer = ['native', (value) => {
|
|
35
35
|
return value.length;
|
|
36
36
|
}];
|
|
37
|
+
/**
|
|
38
|
+
* Length-prefixed array whose declared count is an upper bound when reading.
|
|
39
|
+
* Writing and sizing remain identical to an ordinary array.
|
|
40
|
+
*/
|
|
41
|
+
Read.maybeIncompleteArray = ['parametrizable', (compiler, { countType, type }) => {
|
|
42
|
+
return compiler.wrapCode(`
|
|
43
|
+
const { value: count, size: countSize } = ${compiler.callType(countType)}
|
|
44
|
+
if (count > 0xffffff && !ctx.noArraySizeCheck) throw new Error("array size is abnormally large, not reading: " + count)
|
|
45
|
+
const data = []
|
|
46
|
+
let size = countSize
|
|
47
|
+
for (let i = 0; i < count && offset + size < buffer.length; i++) {
|
|
48
|
+
try {
|
|
49
|
+
const elem = ${compiler.callType(type, 'offset + size')}
|
|
50
|
+
data.push(elem.value)
|
|
51
|
+
size += elem.size
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (error.name !== "PartialReadError") throw error
|
|
54
|
+
break
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { value: data, size }
|
|
58
|
+
`.trim());
|
|
59
|
+
}];
|
|
60
|
+
Write.maybeIncompleteArray = ['parametrizable', (compiler, { countType, type }) => {
|
|
61
|
+
return compiler.wrapCode(`
|
|
62
|
+
offset = ${compiler.callType('value.length', countType)}
|
|
63
|
+
for (let i = 0; i < value.length; i++) {
|
|
64
|
+
offset = ${compiler.callType('value[i]', type)}
|
|
65
|
+
}
|
|
66
|
+
return offset
|
|
67
|
+
`.trim());
|
|
68
|
+
}];
|
|
69
|
+
SizeOf.maybeIncompleteArray = ['parametrizable', (compiler, { countType, type }) => {
|
|
70
|
+
return compiler.wrapCode(`
|
|
71
|
+
let size = ${compiler.callType('value.length', countType)}
|
|
72
|
+
for (let i = 0; i < value.length; i++) {
|
|
73
|
+
size += ${compiler.callType('value[i]', type)}
|
|
74
|
+
}
|
|
75
|
+
return size
|
|
76
|
+
`.trim());
|
|
77
|
+
}];
|
|
78
|
+
/**
|
|
79
|
+
* Terminal field present only when unread packet bytes remain.
|
|
80
|
+
*/
|
|
81
|
+
Read.optionalOnRemaining = ['parametrizable', (compiler, { type }) => {
|
|
82
|
+
return compiler.wrapCode(`
|
|
83
|
+
if (offset >= buffer.length) return { value: undefined, size: 0 }
|
|
84
|
+
return ${compiler.callType(type)}
|
|
85
|
+
`.trim());
|
|
86
|
+
}];
|
|
87
|
+
Write.optionalOnRemaining = ['parametrizable', (compiler, { type }) => {
|
|
88
|
+
return compiler.wrapCode(`
|
|
89
|
+
if (value === undefined) return offset
|
|
90
|
+
return ${compiler.callType('value', type)}
|
|
91
|
+
`.trim());
|
|
92
|
+
}];
|
|
93
|
+
SizeOf.optionalOnRemaining = ['parametrizable', (compiler, { type }) => {
|
|
94
|
+
return compiler.wrapCode(`
|
|
95
|
+
if (value === undefined) return 0
|
|
96
|
+
return ${compiler.callType('value', type)}
|
|
97
|
+
`.trim());
|
|
98
|
+
}];
|
|
37
99
|
/**
|
|
38
100
|
* Encapsulated data with length prefix
|
|
39
101
|
*/
|
package/dist/options.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type Options = {
|
|
|
9
9
|
compressionThreshold: number;
|
|
10
10
|
protocolVersion: number;
|
|
11
11
|
};
|
|
12
|
-
export declare const CURRENT_VERSION = "1.26.
|
|
12
|
+
export declare const CURRENT_VERSION = "1.26.60";
|
|
13
13
|
export declare const defaultOptions: {
|
|
14
14
|
version: string;
|
|
15
15
|
autoInitPlayer: boolean;
|
package/dist/options.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.defaultOptions = exports.CURRENT_VERSION = void 0;
|
|
4
4
|
const framer_1 = require("./transforms/framer");
|
|
5
5
|
// Currently supported verson. Note, clients with newer versions can still connect as long as data is in minecraft-data
|
|
6
|
-
exports.CURRENT_VERSION = '1.26.
|
|
6
|
+
exports.CURRENT_VERSION = '1.26.60';
|
|
7
7
|
exports.defaultOptions = {
|
|
8
8
|
// https://minecraft.wiki/w/Protocol_version#Bedrock_Edition_2
|
|
9
9
|
version: exports.CURRENT_VERSION,
|
|
@@ -22,5 +22,5 @@ exports.defaultOptions = {
|
|
|
22
22
|
// server: If true, only compress if a payload is larger than compressionThreshold
|
|
23
23
|
compressionThreshold: 512,
|
|
24
24
|
// server and client: The protocol version to use
|
|
25
|
-
protocolVersion:
|
|
25
|
+
protocolVersion: 2225,
|
|
26
26
|
};
|