mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
all tests passing with newest protocol
This commit is contained in:
parent
07505da2e8
commit
09a80dddd2
3 changed files with 13 additions and 8 deletions
|
@ -679,10 +679,11 @@ ByteVectorArrayWriter.prototype.write = function(buffer, offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function StringArrayWriter(value) {
|
function StringArrayWriter(value) {
|
||||||
this.value = value;
|
this.value = new Array(value.length);
|
||||||
this.size = 2;
|
this.size = 2;
|
||||||
for (var i = 0; i < this.value.length; ++i) {
|
for (var i = 0; i < value.length; ++i) {
|
||||||
this.value[i] = stringWriter = new StringWriter(this.value[i]);
|
var stringWriter = new StringWriter(value[i]);
|
||||||
|
this.value[i] = stringWriter;
|
||||||
this.size += stringWriter.size;
|
this.size += stringWriter.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1317,7 +1318,7 @@ function parsePacket(buffer, isServer) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version: 60,
|
version: 60,
|
||||||
minecraftVersion: '1.5.0',
|
minecraftVersion: '1.5',
|
||||||
sessionVersion: 13,
|
sessionVersion: 13,
|
||||||
parsePacket: parsePacket,
|
parsePacket: parsePacket,
|
||||||
createPacketBuffer: createPacketBuffer,
|
createPacketBuffer: createPacketBuffer,
|
||||||
|
|
|
@ -26,11 +26,11 @@
|
||||||
"node": ">=0.8.16"
|
"node": ">=0.8.16"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "~1.7.4",
|
"mocha": "~1.8.2",
|
||||||
"mkdirp": "~0.3.4",
|
"mkdirp": "~0.3.4",
|
||||||
"rimraf": "~2.1.1",
|
"rimraf": "~2.1.1",
|
||||||
"zfill": "0.0.1",
|
"zfill": "0.0.1",
|
||||||
"batch": "~0.2.1"
|
"batch": "~0.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ursa": "~0.8.0",
|
"ursa": "~0.8.0",
|
||||||
|
|
|
@ -71,6 +71,7 @@ var values = {
|
||||||
itemDamage: 3,
|
itemDamage: 3,
|
||||||
nbtData: new Buffer(0),
|
nbtData: new Buffer(0),
|
||||||
}],
|
}],
|
||||||
|
'stringArray': ['hello', 'dude'],
|
||||||
'mapChunkBulk': {
|
'mapChunkBulk': {
|
||||||
skyLightSent: true,
|
skyLightSent: true,
|
||||||
compressedChunkData: new Buffer(1234),
|
compressedChunkData: new Buffer(1234),
|
||||||
|
@ -126,7 +127,8 @@ describe("packets", function() {
|
||||||
for(packetId in protocol.packets) {
|
for(packetId in protocol.packets) {
|
||||||
packetId = parseInt(packetId, 10);
|
packetId = parseInt(packetId, 10);
|
||||||
packetInfo = protocol.packets[packetId];
|
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) {
|
function callTestPacket(packetId, packetInfo) {
|
||||||
return function(done) {
|
return function(done) {
|
||||||
|
@ -137,7 +139,9 @@ describe("packets", function() {
|
||||||
batch.push(function(done) {
|
batch.push(function(done) {
|
||||||
testPacket(packetId, protocol.get(packetId, true), done);
|
testPacket(packetId, protocol.get(packetId, true), done);
|
||||||
});
|
});
|
||||||
batch.end(done);
|
batch.end(function(err, results) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function testPacket(packetId, packetInfo, done) {
|
function testPacket(packetId, packetInfo, done) {
|
||||||
|
|
Loading…
Reference in a new issue