mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2025-05-18 17:20:25 -04:00
fix incorrectly swapped stance and y on 0x0d
add test that would have caught the bug
This commit is contained in:
parent
af98e294f8
commit
5a85aa454f
2 changed files with 5 additions and 2 deletions
|
@ -1173,7 +1173,7 @@ function get(packetId, toServer) {
|
||||||
function createPacketBuffer(packetId, params, isServer) {
|
function createPacketBuffer(packetId, params, isServer) {
|
||||||
var size = 1;
|
var size = 1;
|
||||||
var fields = [ new UByteWriter(packetId) ];
|
var fields = [ new UByteWriter(packetId) ];
|
||||||
var packet = get(packetId, isServer);
|
var packet = get(packetId, !isServer);
|
||||||
packet.forEach(function(fieldInfo) {
|
packet.forEach(function(fieldInfo) {
|
||||||
var value = params[fieldInfo.name];
|
var value = params[fieldInfo.name];
|
||||||
var Writer = types[fieldInfo.type][1];
|
var Writer = types[fieldInfo.type][1];
|
||||||
|
@ -1196,7 +1196,7 @@ function parsePacket(buffer, isServer) {
|
||||||
var packetId = buffer.readUInt8(0);
|
var packetId = buffer.readUInt8(0);
|
||||||
var size = 1;
|
var size = 1;
|
||||||
var results = { id: packetId };
|
var results = { id: packetId };
|
||||||
var packetInfo = get(packetId, !isServer);
|
var packetInfo = get(packetId, isServer);
|
||||||
assert.ok(packetInfo, "Unrecognized packetId: " + packetId);
|
assert.ok(packetInfo, "Unrecognized packetId: " + packetId);
|
||||||
var i, fieldInfo, read, readResults;
|
var i, fieldInfo, read, readResults;
|
||||||
for (i = 0; i < packetInfo.length; ++i) {
|
for (i = 0; i < packetInfo.length; ++i) {
|
||||||
|
|
|
@ -359,6 +359,9 @@ describe("client", function() {
|
||||||
done();
|
done();
|
||||||
}, SURVIVE_TIME);
|
}, SURVIVE_TIME);
|
||||||
});
|
});
|
||||||
|
client.on(0x0d, function(packet) {
|
||||||
|
assert.ok(packet.stance > packet.y, "stance should be > y");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue