1.14 support (#628)

This commit is contained in:
Romain Beaumont 2019-05-20 01:46:02 +02:00 committed by GitHub
parent 7c92ac9099
commit b5b500adf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 9 deletions

View file

@ -11,7 +11,7 @@ Parse and serialize minecraft packets, plus authentication and encryption.
## Features ## Features
* 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), * 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.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) and 1.14(1.14, 1.14.1)
* Parses all packets and emits events with packet fields as JavaScript * Parses all packets and emits events with packet fields as JavaScript
objects. objects.
* Send a packet by supplying fields as a JavaScript object. * Send a packet by supplying fields as a JavaScript object.

View file

@ -46,9 +46,9 @@
"endian-toggle": "^0.0.0", "endian-toggle": "^0.0.0",
"lodash.get": "^4.1.2", "lodash.get": "^4.1.2",
"lodash.merge": "^4.3.0", "lodash.merge": "^4.3.0",
"minecraft-data": "^2.34.0", "minecraft-data": "^2.37.3",
"node-rsa": "^0.4.2", "node-rsa": "^0.4.2",
"prismarine-nbt": "^1.2.0", "prismarine-nbt": "^1.2.1",
"protodef": "^1.6.7", "protodef": "^1.6.7",
"readable-stream": "^3.0.6", "readable-stream": "^3.0.6",
"uuid-1345": "^0.99.6", "uuid-1345": "^0.99.6",

View file

@ -15,7 +15,7 @@ function ping (options, cb) {
options.majorVersion = version.majorVersion options.majorVersion = version.majorVersion
options.protocolVersion = version.version options.protocolVersion = version.version
const client = new Client(false, options.majorVersion) const client = new Client(false, version.minecraftVersion)
client.on('error', function (err) { client.on('error', function (err) {
cb(err) cb(err)
}) })

View file

@ -2,5 +2,5 @@
module.exports = { module.exports = {
defaultVersion: '1.13.2', defaultVersion: '1.13.2',
supportedVersions: ['1.7', '1.8', '1.9', '1.10', '1.11.2', '1.12.2', '1.13.2'] supportedVersions: ['1.7', '1.8', '1.9', '1.10', '1.11.2', '1.12.2', '1.13.2', '1.14.1']
} }

View file

@ -104,7 +104,6 @@ mc.supportedVersions.forEach(function (supportedVersion, i) {
let chatCount = 0 let chatCount = 0
client.on('login', function (packet) { client.on('login', function (packet) {
assert.strictEqual(packet.levelType, 'default') assert.strictEqual(packet.levelType, 'default')
assert.strictEqual(packet.difficulty, 1)
assert.strictEqual(packet.dimension, 0) assert.strictEqual(packet.dimension, 0)
assert.strictEqual(packet.gameMode, 0) assert.strictEqual(packet.gameMode, 0)
client.write('chat', { client.write('chat', {

View file

@ -63,8 +63,9 @@ const values = {
'..': context '..': context
} }
Object.keys(typeArgs).forEach(function (index) { Object.keys(typeArgs).forEach(function (index) {
const v = typeArgs[index].name === 'type' && typeArgs[index].type === 'string' const v = typeArgs[index].name === 'type' && typeArgs[index].type === 'string' && typeArgs[2] !== undefined &&
? 'crafting_shapeless' typeArgs[2]['type'] !== undefined
? (typeArgs[2]['type'][1]['fields']['minecraft:crafting_shapeless'] === undefined ? 'crafting_shapeless' : 'minecraft:crafting_shapeless')
: getValue(typeArgs[index].type, results) : getValue(typeArgs[index].type, results)
if (typeArgs[index].anon) { if (typeArgs[index].anon) {
Object.keys(v).forEach(key => { Object.keys(v).forEach(key => {

View file

@ -173,7 +173,6 @@ mc.supportedVersions.forEach(function (supportedVersion, i) {
assert.strictEqual(packet.gameMode, 1) assert.strictEqual(packet.gameMode, 1)
assert.strictEqual(packet.levelType, 'default') assert.strictEqual(packet.levelType, 'default')
assert.strictEqual(packet.dimension, 0) assert.strictEqual(packet.dimension, 0)
assert.strictEqual(packet.difficulty, 2)
player1.once('chat', function (packet) { player1.once('chat', function (packet) {
assert.strictEqual(packet.message, '{"text":"player2 joined the game."}') assert.strictEqual(packet.message, '{"text":"player2 joined the game."}')
player1.once('chat', function (packet) { player1.once('chat', function (packet) {