Skip to content

Commit

Permalink
Update workerstream dependency for Buffer conversion PR
Browse files Browse the repository at this point in the history
for max-mapper/workerstream#11
Emit data event data as a Buffer
  • Loading branch information
deathcap committed Mar 25, 2015
1 parent f53487d commit b2419d1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
7 changes: 6 additions & 1 deletion clientmc.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,20 @@ ClientMC.prototype.enable = function() {
});
*/

// create bot
// create bot TODO: fully move to mf-worker
/*
this.bot = mineflayer.createBot({
username: username,
stream: this.websocketStream,
});
*/

this.game.voxels.on('missingChunk', this.missingChunk.bind(this));

this.voxelChunks = {};

/* TODO
// WebSocket to server proxy (wsmc)
var self = this;
this.bot.on('error', function(err) {
Expand Down Expand Up @@ -314,6 +318,7 @@ ClientMC.prototype.enable = function() {
self.commands.isConnectedToServer = true;
});
*/

var maxId = 255; // TODO: 4096?

Expand Down
16 changes: 12 additions & 4 deletions mf-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@ var mineflayer = require('wsmc/mineflayer-stream');

module.exports = function(self) {
console.log('mf-worker initializing',self);
console.log('Object=',Object.prototype);
debugger;

self.parentStream = ParentStream();

/*
self.bot = mineflayer.createBot({
username: 'user1', // TODO
stream: self.parentStream,
});

console.log('mf-worker bot',self.bot);
*/

self.bot.on('game', function() {
console.log('Spawn position: '+JSON.stringify(self.bot.spawnPoint));
});

self.bot.on('kicked', function(reason) {
console.log('mf-worker bot kicked because:',reason);
});

/*
self.onmessage = function(event) {
console.log('mf-worker onmessage',event);
//self.postMessage({whats: 'up'});
self.postMessage({whats: 'up'});
};
*/
};

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"vec3": "^0.1.3",
"websocket-stream": "^1.4.0",
"webworkify": "^1.0.2",
"workerstream": "^1.2.1",
"workerstream": "git://github.com/deathcap/workerstream.git#buffer",
"wsmc": "git://github.com/deathcap/wsmc.git#master"
},
"scripts": {
Expand Down

0 comments on commit b2419d1

Please sign in to comment.