all tests passing with newest protocol

This commit is contained in:
Andrew Kelley 2013-03-13 23:27:15 -04:00
parent 07505da2e8
commit 09a80dddd2
3 changed files with 13 additions and 8 deletions

View file

@ -679,10 +679,11 @@ ByteVectorArrayWriter.prototype.write = function(buffer, offset) {
}
function StringArrayWriter(value) {
this.value = value;
this.value = new Array(value.length);
this.size = 2;
for (var i = 0; i < this.value.length; ++i) {
this.value[i] = stringWriter = new StringWriter(this.value[i]);
for (var i = 0; i < value.length; ++i) {
var stringWriter = new StringWriter(value[i]);
this.value[i] = stringWriter;
this.size += stringWriter.size;
}
}
@ -1317,7 +1318,7 @@ function parsePacket(buffer, isServer) {
module.exports = {
version: 60,
minecraftVersion: '1.5.0',
minecraftVersion: '1.5',
sessionVersion: 13,
parsePacket: parsePacket,
createPacketBuffer: createPacketBuffer,

View file

@ -26,11 +26,11 @@
"node": ">=0.8.16"
},
"devDependencies": {
"mocha": "~1.7.4",
"mocha": "~1.8.2",
"mkdirp": "~0.3.4",
"rimraf": "~2.1.1",
"zfill": "0.0.1",
"batch": "~0.2.1"
"batch": "~0.3.1"
},
"dependencies": {
"ursa": "~0.8.0",

View file

@ -71,6 +71,7 @@ var values = {
itemDamage: 3,
nbtData: new Buffer(0),
}],
'stringArray': ['hello', 'dude'],
'mapChunkBulk': {
skyLightSent: true,
compressedChunkData: new Buffer(1234),
@ -126,7 +127,8 @@ describe("packets", function() {
for(packetId in protocol.packets) {
packetId = parseInt(packetId, 10);
packetInfo = protocol.packets[packetId];
it("0x" + zfill(parseInt(packetId, 10).toString(16), 2), callTestPacket(packetId, packetInfo));
it("0x" + zfill(parseInt(packetId, 10).toString(16), 2),
callTestPacket(packetId, packetInfo));
}
function callTestPacket(packetId, packetInfo) {
return function(done) {
@ -137,7 +139,9 @@ describe("packets", function() {
batch.push(function(done) {
testPacket(packetId, protocol.get(packetId, true), done);
});
batch.end(done);
batch.end(function(err, results) {
done();
});
};
}
function testPacket(packetId, packetInfo, done) {