mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-15 12:31:09 +00:00
Initial commit
This commit is contained in:
parent
817912180b
commit
9609f1261b
4 changed files with 21 additions and 21 deletions
|
|
@ -1,6 +1,6 @@
|
|||
mc-plain-server
|
||||
node-minecraft-server
|
||||
==============
|
||||
|
||||
This is mc-plain-server.
|
||||
This is a Minecraft server written in node.js for minecraft 1.8
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ var states = mc.protocol.states;
|
|||
var World = require('./world');
|
||||
|
||||
var options = {
|
||||
motd: 'Vox Industries',
|
||||
'max-players': 127,
|
||||
motd: 'Minecraft Server',
|
||||
'max-players': 20,
|
||||
port: 25565,
|
||||
'online-mode': false,
|
||||
};
|
||||
|
|
@ -19,9 +19,9 @@ for (var x = 0; x < 16;x++) {
|
|||
var server = mc.createServer(options);
|
||||
|
||||
server.on('login', function(client) {
|
||||
broadcast({ text: client.username+' joined the game.', color: "yellow" });
|
||||
broadcast({ text: client.username + ' joined the game.', color: "yellow" });
|
||||
var addr = client.socket.remoteAddress + ':' + client.socket.remotePort;
|
||||
console.log(client.username+' connected', '('+addr+')');
|
||||
console.log(client.username + ' connected', '(' + addr + ')');
|
||||
|
||||
client.on('end', function() {
|
||||
broadcast({ text: client.username+' left the game.', color: "yellow" });
|
||||
14
package.json
14
package.json
|
|
@ -1,25 +1,25 @@
|
|||
{
|
||||
"name": "mc-plain-server",
|
||||
"description": "",
|
||||
"name": "node-minecraft-server",
|
||||
"description": "A minecraft server written in node.js",
|
||||
"version": "0.0.1",
|
||||
"main": "./mc-plain-server.js",
|
||||
"main": "app.js",
|
||||
"author": {
|
||||
"name": "roblabla",
|
||||
"email": "robinlambertz.dev@gmail.com"
|
||||
},
|
||||
"keywords": [],
|
||||
"licenses": {
|
||||
"type": "mit"
|
||||
"type": "MIT"
|
||||
},
|
||||
"dependencies": {
|
||||
"minecraft-protocol": "git://github.com/roblabla/node-minecraft-protocol.git#feature-mc1.7",
|
||||
"minecraft-protocol": "git://github.com/roblabla/node-minecraft-protocol.git",
|
||||
"buffers": "0.1.1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/YOUR_LOGIN/mc-plain-server.git"
|
||||
"url": "git://github.com/mhsjlw/node-minecraft-server.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/YOUR_LOGIN/mc-plain-server/issues"
|
||||
"url": "http://github.com/mhsjlw/node-minecraft-server/issues"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
world.js
16
world.js
|
|
@ -1,6 +1,6 @@
|
|||
var util = require('util')
|
||||
, zlib = require('zlib')
|
||||
, Buffers = require('buffers');
|
||||
var zlib = require('zlib')
|
||||
var Buffers = require('buffers');
|
||||
|
||||
module.exports = World;
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ ChunkColumn.prototype.unpack_section = function(buff, section, mask) {
|
|||
}
|
||||
|
||||
ChunkColumn.prototype.pack = function() {
|
||||
var bufs = new Buffers();
|
||||
var bufs = new Buffers[];
|
||||
var mask1 = 0;
|
||||
for (var i = 0; i < 16; i++) {
|
||||
if (this.chunks[i] !== null) {
|
||||
|
|
@ -155,7 +155,7 @@ ChunkColumn.prototype.pack = function() {
|
|||
var mask2 = 0;
|
||||
bufs.push(block_data, block_meta, light_block, light_sky);
|
||||
return {
|
||||
data: bufs.toBuffer(),
|
||||
data: Buffer.concat(bufs),
|
||||
mask1: mask1,
|
||||
mask2: mask2,
|
||||
skylight: true
|
||||
|
|
@ -163,12 +163,12 @@ ChunkColumn.prototype.pack = function() {
|
|||
}
|
||||
|
||||
ChunkColumn.prototype.pack_section = function(section) {
|
||||
var bufs = new Buffers();
|
||||
var bufs = new Buffers[];
|
||||
for (var i = 0; i < 16; i++) {
|
||||
if (this.chunks[i] !== null)
|
||||
bufs.push(this.chunks[i][section].pack());
|
||||
}
|
||||
return bufs.toBuffer();
|
||||
return Buffer.concat(bufs);
|
||||
}
|
||||
|
||||
function World() {
|
||||
|
|
@ -192,7 +192,7 @@ World.prototype.unpack = function(packetData) {
|
|||
}
|
||||
|
||||
World.prototype.packMapChunkBulk = function() {
|
||||
var bufs = new Buffers();
|
||||
var bufs = new Buffers[];
|
||||
var metadatas = [];
|
||||
var cb = arguments[arguments.length - 1];
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ World.prototype.packMapChunkBulk = function() {
|
|||
console.log("error");
|
||||
cb(err);
|
||||
});
|
||||
deflate.write(bufs.toBuffer());
|
||||
deflate.write(Buffer.concat(bufs));
|
||||
deflate.end();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue