Parse and serialize minecraft packets, plus authentication and encryption.
rom1504 on master
allow false as beforePing callb… (compare)
rom1504 on master
Fallback version for dynamic ve… (compare)
u9g on master
Add motdMsg to createServer (#9… (compare)
u9g on npm_and_yarn
u9g on master
Bump standard from 16.0.4 to 17… (compare)
client.queue('player_action', let action = {action: 5, runtime_entity_id: client.uuid, position:0, face: 0})
throw e
^
TypeError: SizeOf error for undefined : Cannot read properties of undefined (reading 'valueOf')
at Object.sizeOfVarLong [as varint64] (/mc/node_modules/bedrock-protocol/src/datatypes/varlong.js:2:20)
at Object.packet_player_action (eval at compile (/mc/node_modules/protodef/src/compiler.js:258:12), <anonymous>:2466:29)
at eval (eval at compile (/mc/node_modules/protodef/src/compiler.js:258:12), <anonymous>:1686:66)
at mcpe_packet (eval at compile (/mc/node_modules/protodef/src/compiler.js:258:12), <anonymous>:1822:9)
at CompiledProtodef.sizeOf (/mc/node_modules/protodef/src/compiler.js:89:14)
at e.message (/mc/node_modules/protodef/src/compiler.js:96:40)
at tryCatch (/mc/node_modules/protodef/src/utils.js:50:16)
at CompiledProtodef.createPacketBuffer (/mc/node_modules/protodef/src/compiler.js:96:20)
at Serializer.createPacketBuffer (/mc/node_modules/protodef/src/serializer.js:12:23)
at Client.queue (/mc/node_modules/bedrock-protocol/src/connection.js:77:36)
js
PartialReadError: Read error for undefined : Missing characters in string, found size is 40799 expected size was 420740095
at new ExtendableError (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\utils.js:63:13)
at new PartialReadError (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\utils.js:70:5)
at Object.string (eval at compile (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:258:12), <anonymous>:47:15)
at eval (eval at compile (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:258:12), <anonymous>:1837:69)
at eval (eval at compile (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:258:12), <anonymous>:1923:11)
at Object.packet_declare_recipes (eval at compile (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:258:12), <anonymous>:1928:9)
at eval (eval at compile (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:258:12), <anonymous>:2041:70)
at packet (eval at compile (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:258:12), <anonymous>:2046:9)
at CompiledProtodef.read (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:70:12)
at e.message (C:\Users\Jason\Documents\js-projects\cosmic-lore-bot\node_modules\protodef\src\compiler.js:111:49)
<TheGameSpider> Hello, I am trying to send custom_payload
packet using
client.write("custom_payload", packet)
, and I am getting this error
Caught exception: RangeError [ERR_INVALID_ARG_VALUE]: The argument 'size' is invalid. Received NaN
at Function.allocUnsafe (node:buffer:371:3)
at CompiledProtodef.createPacketBuffer (/home/ubuntu/mc/node_modules/protodef/src/compiler.js:101:27)
at Serializer.createPacketBuffer (/home/ubuntu/mc/node_modules/protodef/src/serializer.js:12:23)
at Serializer._transform (/home/ubuntu/mc/node_modules/protodef/src/serializer.js:18:18)
at Serializer.Transform._read (/home/ubuntu/mc/node_modules/readable-stream/lib/_stream_transform.js:177:10)
at Serializer.Transform._write (/home/ubuntu/mc/node_modules/readable-stream/lib/_stream_transform.js:164:83)
at doWrite (/home/ubuntu/mc/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/home/ubuntu/mc/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Serializer.Writable.write (/home/ubuntu/mc/node_modules/readable-stream/lib/_stream_writable.js:307:11)
at Client.write (/home/ubuntu/mc/node_modules/minecraft-protocol/src/client.js:221:21) {
code: 'ERR_INVALID_ARG_VALUE',
field: 'play.toServer'
}
<paradise> ```js
const mc = require('minecraft-protocol');
const handleServer = (server) => {
try {
var client = mc.createClient({
host: "localhost", // optional
port: 25565, // optional
username: "Symphony",
version: false
});
client.on('login', function(packet) {
client.write('chat', {message: "xyz"});
client.end();
});
} catch (e) { console.error(e); }
}
```