mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05: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) {
|
||||
var size = 1;
|
||||
var fields = [ new UByteWriter(packetId) ];
|
||||
var packet = get(packetId, isServer);
|
||||
var packet = get(packetId, !isServer);
|
||||
packet.forEach(function(fieldInfo) {
|
||||
var value = params[fieldInfo.name];
|
||||
var Writer = types[fieldInfo.type][1];
|
||||
|
@ -1196,7 +1196,7 @@ function parsePacket(buffer, isServer) {
|
|||
var packetId = buffer.readUInt8(0);
|
||||
var size = 1;
|
||||
var results = { id: packetId };
|
||||
var packetInfo = get(packetId, !isServer);
|
||||
var packetInfo = get(packetId, isServer);
|
||||
assert.ok(packetInfo, "Unrecognized packetId: " + packetId);
|
||||
var i, fieldInfo, read, readResults;
|
||||
for (i = 0; i < packetInfo.length; ++i) {
|
||||
|
|
|
@ -359,6 +359,9 @@ describe("client", function() {
|
|||
done();
|
||||
}, SURVIVE_TIME);
|
||||
});
|
||||
client.on(0x0d, function(packet) {
|
||||
assert.ok(packet.stance > packet.y, "stance should be > y");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue