mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 05:35:56 -04:00
Merge upstream, fix mistakes in examples
This commit is contained in:
commit
2f90252eaa
@ -25,9 +25,9 @@ Parse and serialize minecraft packets, plus authentication and encryption.
|
||||
|
||||
## Projects Using node-minecraft-protocol
|
||||
|
||||
* [mineflayer](https://github.com/superjoe30/mineflayer/) - create minecraft
|
||||
* [mineflayer](https://github.com/andrewrk/mineflayer/) - create minecraft
|
||||
bots with a stable, high level API.
|
||||
* [mcserve](https://github.com/superjoe30/mcserve) - runs and monitors your
|
||||
* [mcserve](https://github.com/andrewrk/mcserve) - runs and monitors your
|
||||
minecraft server, provides real-time web interface, allow your users to
|
||||
create bots.
|
||||
|
||||
@ -320,7 +320,7 @@ NODE_DEBUG="minecraft-protocol" node [...]
|
||||
### 0.11.0
|
||||
|
||||
* support minecraft protocol 1.6.1 / protocol version 73 (thanks [Matt Bell](https://github.com/mappum))
|
||||
* *note:* chat packets have a new format (see [the examples](https://github.com/superjoe30/node-minecraft-protocol/tree/master/examples) for how to upgrade).
|
||||
* *note:* chat packets have a new format (see [the examples](https://github.com/andrewrk/node-minecraft-protocol/tree/master/examples) for how to upgrade).
|
||||
|
||||
### 0.10.1
|
||||
|
||||
|
@ -94,7 +94,7 @@ client.on('connect', function() {
|
||||
client.on('state', function(newState) {
|
||||
if (newState === states.PLAY) {
|
||||
chats.forEach(function(chat) {
|
||||
client.write('chat_message', {message: chat});
|
||||
client.write('chat', {message: chat});
|
||||
});
|
||||
}
|
||||
})
|
||||
|
@ -21,7 +21,7 @@ server.on('login', function(client) {
|
||||
});
|
||||
|
||||
// send init data so client will start rendering world
|
||||
client.write('join_game', {
|
||||
client.write('login', {
|
||||
entityId: client.id,
|
||||
levelType: 'default',
|
||||
gameMode: 1,
|
||||
@ -29,7 +29,7 @@ server.on('login', function(client) {
|
||||
difficulty: 2,
|
||||
maxPlayers: server.maxPlayers
|
||||
});
|
||||
client.write('player_position', {
|
||||
client.write('position', {
|
||||
x: 0,
|
||||
y: 256,
|
||||
z: 0,
|
||||
|
@ -475,7 +475,7 @@ var packets = {
|
||||
]},
|
||||
use_entity: {id: 0x02, fields: [
|
||||
{ name: "target", type: "int" },
|
||||
{ name: "leftClick", type: "byte" }
|
||||
{ name: "mouse", type: "byte" }
|
||||
]},
|
||||
flying: {id: 0x03, fields: [
|
||||
{ name: "onGround", type: "bool" }
|
||||
@ -1393,19 +1393,22 @@ function writeSlot(value, buffer, offset) {
|
||||
}
|
||||
|
||||
function sizeOfString(value) {
|
||||
assert.ok(value.length < STRING_MAX_LENGTH, "string greater than max length");
|
||||
return sizeOfVarInt(value.length) + value.length;
|
||||
var length = Buffer.byteLength(value, 'utf8');
|
||||
assert.ok(length < STRING_MAX_LENGTH, "string greater than max length");
|
||||
return sizeOfVarInt(length) + length;
|
||||
}
|
||||
|
||||
function sizeOfUString(value) {
|
||||
assert.ok(value.length < SRV_STRING_MAX_LENGTH, "string greater than max length");
|
||||
return sizeOfVarInt(value.length) + value.length;
|
||||
var length = Buffer.byteLength(value, 'utf8');
|
||||
assert.ok(length < SRV_STRING_MAX_LENGTH, "string greater than max length");
|
||||
return sizeOfVarInt(length) + length;
|
||||
}
|
||||
|
||||
function writeString(value, buffer, offset) {
|
||||
offset = writeVarInt(value.length, buffer, offset);
|
||||
buffer.write(value, offset, value.length, 'utf8');
|
||||
return offset + value.length;
|
||||
var length = Buffer.byteLength(value, 'utf8');
|
||||
offset = writeVarInt(length, buffer, offset);
|
||||
buffer.write(value, offset, length, 'utf8');
|
||||
return offset + length;
|
||||
}
|
||||
|
||||
function sizeOfAscii(value) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/superjoe30/node-minecraft-protocol.git"
|
||||
"url": "git://github.com/andrewrk/node-minecraft-protocol.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec"
|
||||
|
Loading…
x
Reference in New Issue
Block a user