1.16.220 support (#66)

* 1.16.220 initial support

* 1.16.220 fixes, electron gcm

* 1.16.220 item stack fix
This commit is contained in:
extremeheat 2021-04-16 16:40:38 -04:00 committed by GitHub
commit d3723ef42a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 8920 additions and 133 deletions

View file

@ -1,17 +1,15 @@
// process.env.DEBUG = 'minecraft-protocol raknet'
const { Server, Client } = require('../')
const { dumpPackets, hasDumps } = require('../tools/genPacketDumps')
const { dumpPackets } = require('../tools/genPacketDumps')
const DataProvider = require('../data/provider')
// First we need to dump some packets that a vanilla server would send a vanilla
// client. Then we can replay those back in our custom server.
function prepare (version) {
if (!hasDumps(version)) {
return dumpPackets(version)
}
return dumpPackets(version)
}
async function startTest (version = '1.16.210', ok) {
async function startTest (version = '1.16.201', ok) {
await prepare(version)
const Item = require('../types/Item')(version)
const port = 19130
@ -36,7 +34,7 @@ async function startTest (version = '1.16.210', ok) {
// server logic
server.on('connect', client => {
client.on('join', () => {
console.log('Client joined', client.getData())
console.log('Client joined server', client.getData())
client.write('resource_packs_info', {
must_accept: false,

View file

@ -1,11 +1,15 @@
/* eslint-env jest */
const { timedTest } = require('./internal')
const { Versions } = require('../src/options')
describe('internal client/server test', function () {
this.timeout(120 * 1000)
it('connects', async () => {
await timedTest()
for (const version in Versions) {
console.debug(version)
await timedTest(version)
}
})
})

View file

@ -3,10 +3,11 @@ const vanillaServer = require('../tools/startVanillaServer')
const { Client } = require('../src/client')
const { waitFor } = require('../src/datatypes/util')
const { ChunkColumn, Version } = require('bedrock-provider')
const { CURRENT_VERSION } = require('../src/options')
async function test (version) {
// Start the server, wait for it to accept clients, throws on timeout
const handle = await vanillaServer.startServerAndWait(version, 1000 * 120)
const handle = await vanillaServer.startServerAndWait(version, 1000 * 220)
console.log('Started server')
const client = new Client({
@ -65,5 +66,5 @@ async function test (version) {
clearInterval(loop)
}
if (!module.parent) test()
if (!module.parent) test(CURRENT_VERSION)
module.exports = { clientTest: test }