Closed deathcap closed 8 years ago
multi_block_change http://wiki.vg/Protocol#Multi_Block_Change packet (vs single block_change)
voxel-clientmc/chunks.js
clientmc.handlers.setBlock = (event) => {
clientmc.game.setBlock(event.position, event.value);
};
voxel-clientmc/mfworker.js
let pos = [0,0,0];
self.bot.on('blockUpdate', function(oldBlock, newBlock) {
console.log('blockUpdate', oldBlock, newBlock);
const position = newBlock.position;
pos[0] = position.x;
pos[1] = position.y;
pos[2] = position.z;
const val = self.translateBlockID((newBlock.type << 4) | newBlock.metadata);
self.postMessage({cmd: 'setBlock', position: pos, value: val});
//self.game.setBlock(pos, val);
});
// TODO: also handle mass block update (event? would like to optimize multi_block_change, but..)
Oh this was already fixed in mineflayer: https://github.com/PrismarineJS/mineflayer/pull/364 Corrected multi_block_change https://github.com/PrismarineJS/mineflayer/commit/0fc7d0a5154b3c116917855496d77a93d4fc498f, just needed to update wsmc:
https://github.com/deathcap/wsmc/commit/d1cf6252ae27c95eb0a010dc8407b375c2f61ade Update to latest mineflayer
Other clients playing blocks correctly updates the web client, but not when a sapling grows into a tree: