mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 06:03:33 -04:00
fix proxy relatively to the unexposing of createPacketBuffer
also fix a small bug in serializer.js
This commit is contained in:
parent
917b6adda1
commit
7871ac446a
@ -128,8 +128,8 @@ srv.on('login', function(client) {
|
||||
targetClient.on('raw', function(buffer, meta) {
|
||||
if(client.state != states.PLAY || meta.state != states.PLAY)
|
||||
return;
|
||||
var packetData = mc.parsePacketData(buffer, meta.state, false, {"packet": 1}).data;
|
||||
var packetBuff = mc.createPacketBuffer(meta.name, meta.state, packetData, true);
|
||||
var packetData = targetClient.deserializer.parsePacketData(buffer).data;
|
||||
var packetBuff = client.serializer.createPacketBuffer(meta.name, packetData);
|
||||
if(buffertools.compare(buffer, packetBuff) != 0) {
|
||||
console.log("client<-server: Error in packet " + state + "." + meta.name);
|
||||
console.log(buffer.toString('hex'));
|
||||
@ -148,8 +148,8 @@ srv.on('login', function(client) {
|
||||
client.on('raw', function(buffer, meta) {
|
||||
if(meta.state != states.PLAY || targetClient.state != states.PLAY)
|
||||
return;
|
||||
var packetData = mc.parsePacketData(buffer, meta.state, true, {"packet": 1}).data;
|
||||
var packetBuff = mc.createPacketBuffer(meta.name, meta.state, packetData, false);
|
||||
var packetData = client.deserializer.parsePacketData(buffer).data;
|
||||
var packetBuff = targetClient.serializer.createPacketBuffer(meta.name, packetData);
|
||||
if(buffertools.compare(buffer, packetBuff) != 0) {
|
||||
console.log("client->server: Error in packet " + state + "." + meta.name);
|
||||
console.log(buffer.toString('hex'));
|
||||
|
@ -65,7 +65,7 @@ class Serializer extends Transform {
|
||||
createPacketBuffer(packetName, params) {
|
||||
var direction = !this.isServer ? 'toServer' : 'toClient';
|
||||
var packetId = this.packetIds[this.protocolState][direction][packetName];
|
||||
assert.notEqual(packetId, undefined, `${this.protocolState}.${this.isServer}.${packetName} : ${packetId}`);
|
||||
assert.notEqual(packetId, undefined, `${this.protocolState}.${direction}.${packetName} : ${packetId}`);
|
||||
var packet = this.packetFields[this.protocolState][direction][packetName];
|
||||
packet=packet ? packet : null;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user