minecraft-protocol
Advanced tools
Comparing version 1.11.0 to 1.12.0
@@ -7,5 +7,5 @@ { | ||
"ansi-color": "^0.2.1", | ||
"readline": "0.0.7" | ||
"readline": "0.0.8" | ||
}, | ||
"description": "A node-minecraft-protocol example" | ||
} |
@@ -6,5 +6,5 @@ { | ||
"dependencies": { | ||
"buffer-equal": "0.0.1" | ||
"buffer-equal": "0.0.2" | ||
}, | ||
"description": "A node-minecraft-protocol example" | ||
} |
# History | ||
## 1.12.0 | ||
* use protodef compiler, making node-minecraft-protocol 10x faster, thanks for this huge improvement @Karang | ||
## 1.11.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "minecraft-protocol", | ||
"version": "1.11.0", | ||
"version": "1.12.0", | ||
"description": "Parse and serialize minecraft packets, plus authentication and encryption.", | ||
@@ -12,4 +12,3 @@ "main": "src/index.js", | ||
"scripts": { | ||
"prepublish": "require-self", | ||
"test": "mocha --recursive --reporter spec", | ||
"test": "mocha --recursive --reporter spec --exit", | ||
"lint": "standard", | ||
@@ -36,3 +35,3 @@ "fix": "standard --fix", | ||
"devDependencies": { | ||
"@types/node": "^13.1.0", | ||
"@types/node": "^14.0.1", | ||
"espower-loader": "^1.0.0", | ||
@@ -44,3 +43,3 @@ "intelli-espower-loader": "^1.0.0", | ||
"require-self": "^0.2.1", | ||
"standard": "^14.0.0" | ||
"standard": "^14.3.4" | ||
}, | ||
@@ -54,9 +53,9 @@ "dependencies": { | ||
"lodash.merge": "^4.3.0", | ||
"minecraft-data": "^2.41.0", | ||
"minecraft-data": "^2.44.0", | ||
"node-rsa": "^0.4.2", | ||
"prismarine-nbt": "^1.2.1", | ||
"protodef": "^1.6.7", | ||
"prismarine-nbt": "^1.3.0", | ||
"protodef": "^1.7.0", | ||
"readable-stream": "^3.0.6", | ||
"uuid-1345": "^0.99.6" | ||
"uuid-1345": "^1.0.1" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # minecraft protocol | ||
[![Irc](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://irc.gitter.im/) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/PrismarineJS/node-minecraft-protocol.svg)](https://greenkeeper.io/) | ||
[![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/PrismarineJS/node-minecraft-protocol) | ||
@@ -16,4 +16,4 @@ | ||
* Supports Minecraft PC version 1.7.10, 1.8.8, 1.9 (15w40b, 1.9, 1.9.1-pre2, 1.9.2, 1.9.4), | ||
1.10 (16w20a, 1.10-pre1, 1.10, 1.10.1, 1.10.2), 1.11 (16w35a, 1.11, 1.11.2), 1.12 (17w15a, 17w18b, 1.12-pre4, 1.12, 1.12.1, 1.12.2), and 1.13 (17w50a, 1.13, 1.13.1, 1.13.2-pre1, 1.13.2-pre2, 1.13.2), 1.14(1.14, 1.14.1, 1.14.3, 1.14.4) | ||
and 1.15(1.15, 1.15.1) | ||
1.10 (16w20a, 1.10-pre1, 1.10, 1.10.1, 1.10.2), 1.11 (16w35a, 1.11, 1.11.2), 1.12 (17w15a, 17w18b, 1.12-pre4, 1.12, 1.12.1, 1.12.2), and 1.13 (17w50a, 1.13, 1.13.1, 1.13.2-pre1, 1.13.2-pre2, 1.13.2), 1.14 (1.14, 1.14.1, 1.14.3, 1.14.4) | ||
, 1.15 (1.15, 1.15.1, 1.15.2) and 1.16 (20w13b) | ||
* Parses all packets and emits events with packet fields as JavaScript | ||
@@ -38,2 +38,4 @@ objects. | ||
* Optimized for rapidly staying up to date with Minecraft protocol updates. | ||
Want to contribute on something important for PrismarineJS ? go to https://github.com/PrismarineJS/mineflayer/wiki/Big-Prismarine-projects | ||
@@ -55,2 +57,3 @@ ## Third Party Plugins | ||
servers with a high level API, also a minecraft server by itself. | ||
* [minecraft-packet-debugger](https://github.com/wvffle/minecraft-packet-debugger) to easily debug your minecraft packets | ||
@@ -76,3 +79,3 @@ ## Usage | ||
if(username === client.username) return; | ||
client.write('chat', {message: msg}); | ||
client.write('chat', {message: msg.text}); | ||
} | ||
@@ -101,4 +104,6 @@ }); | ||
difficulty: 2, | ||
hashedSeed: [0, 0], | ||
maxPlayers: server.maxPlayers, | ||
reducedDebugInfo: false | ||
reducedDebugInfo: false, | ||
enableRespawnScreen: true | ||
}); | ||
@@ -105,0 +110,0 @@ client.write('position', { |
@@ -86,2 +86,3 @@ const UUID = require('uuid-1345') | ||
client.uuid = profile.id.replace(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/, '$1-$2-$3-$4-$5') | ||
client.username = profile.name | ||
client.profile = profile | ||
@@ -88,0 +89,0 @@ loginClient() |
@@ -55,3 +55,3 @@ 'use strict' | ||
} else { | ||
zlib.unzip(chunk.slice(size), { finishFlush: zlib.constants.Z_SYNC_FLUSH }, (err, newBuf) => { /** Fix by lefela4. */ | ||
zlib.unzip(chunk.slice(size), { finishFlush: 2 /* Z_SYNC_FLUSH = 2, but when using Browserify/Webpack it doesn't exist */ }, (err, newBuf) => { /** Fix by lefela4. */ | ||
if (err) { | ||
@@ -58,0 +58,0 @@ if (!this.hideErrors) { |
@@ -6,2 +6,3 @@ 'use strict' | ||
const Parser = require('protodef').FullPacketParser | ||
const { ProtoDefCompiler } = require('protodef').Compiler | ||
@@ -15,8 +16,18 @@ const minecraft = require('../datatypes/minecraft') | ||
function createProtocol (state, direction, version, customPackets) { | ||
const key = state + ';' + direction + ';' + version | ||
function createProtocol (state, direction, version, customPackets, compiled = true) { | ||
const key = state + ';' + direction + ';' + version + (compiled ? ';c' : '') | ||
if (protocols[key]) { return protocols[key] } | ||
const mcData = require('minecraft-data')(version) | ||
if (compiled) { | ||
const compiler = new ProtoDefCompiler() | ||
compiler.addTypes(require('../datatypes/compiler-minecraft')) | ||
compiler.addProtocol(merge(mcData.protocol, get(customPackets, [mcData.version.majorVersion])), [state, direction]) | ||
const proto = compiler.compileProtoDefSync() | ||
protocols[key] = proto | ||
return proto | ||
} | ||
const proto = new ProtoDef(false) | ||
proto.addTypes(minecraft) | ||
const mcData = require('minecraft-data')(version) | ||
proto.addProtocol(merge(mcData.protocol, get(customPackets, [mcData.version.majorVersion])), [state, direction]) | ||
@@ -27,8 +38,8 @@ protocols[key] = proto | ||
function createSerializer ({ state = states.HANDSHAKING, isServer = false, version, customPackets } = {}) { | ||
return new Serializer(createProtocol(state, !isServer ? 'toServer' : 'toClient', version, customPackets), 'packet') | ||
function createSerializer ({ state = states.HANDSHAKING, isServer = false, version, customPackets, compiled = true } = {}) { | ||
return new Serializer(createProtocol(state, !isServer ? 'toServer' : 'toClient', version, customPackets, compiled), 'packet') | ||
} | ||
function createDeserializer ({ state = states.HANDSHAKING, isServer = false, version, customPackets } = {}) { | ||
return new Parser(createProtocol(state, isServer ? 'toServer' : 'toClient', version, customPackets), 'packet') | ||
function createDeserializer ({ state = states.HANDSHAKING, isServer = false, version, customPackets, compiled = true } = {}) { | ||
return new Parser(createProtocol(state, isServer ? 'toServer' : 'toClient', version, customPackets, compiled), 'packet') | ||
} | ||
@@ -35,0 +46,0 @@ |
'use strict' | ||
module.exports = { | ||
defaultVersion: '1.15.1', | ||
supportedVersions: ['1.7', '1.8', '1.9', '1.10', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.1'] | ||
defaultVersion: '1.15.2', | ||
supportedVersions: ['1.7', '1.8', '1.9', '1.10', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '20w13b'] | ||
} |
@@ -80,3 +80,3 @@ /* eslint-env mocha */ | ||
}) | ||
delete context['..'] | ||
delete results['..'] | ||
return results | ||
@@ -272,4 +272,6 @@ }, | ||
Object.keys(p2).forEach(function (field) { | ||
assert.ok(field in p1, 'field ' + field + ' missing in p1, in p2 it has value ' + | ||
JSON.stringify(p2[field])) | ||
if (p2[field] !== undefined) { | ||
assert.ok(field in p1, 'field ' + field + ' missing in p1, in p2 it has value ' + | ||
JSON.stringify(p2[field])) | ||
} | ||
}) | ||
@@ -276,0 +278,0 @@ } |
145061
72
3215
165
+ Addedmacaddress@0.5.3(transitive)
+ Addeduuid-1345@1.0.2(transitive)
- Removedmacaddress@0.2.9(transitive)
- Removeduuid-1345@0.99.7(transitive)
Updatedminecraft-data@^2.44.0
Updatedprismarine-nbt@^1.3.0
Updatedprotodef@^1.7.0
Updateduuid-1345@^1.0.1