-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken with minecraft-protocol 0.16, missing protocol property #19
Comments
Works with [email protected], fails with [email protected] bisected to: PrismarineJS/node-minecraft-protocol@1a9e08c move createPacketBuffer and parsePacketData functions to serializer, also move protocol's exports to serializer Looks like minecraft_protocol.protocol. changed to just minecraft_protocol. Works up to 0.15.0, but then in the next release 0.16.0, changed again:
|
Began to update to 0.15.0 on https://github.com/deathcap/wsmc/compare/nmp0.15.0 - but
Probably ought to just update straight to minecraft-protocol 0.16.0. But what version specifier should I use for API compatibility with this module? ^0.15.0 would pickup ^0.16.0. since "^" only locks the major version, accepts changes minor and patch - it may be acceptable to use ~0.15.0, to lock major and minor, only allowing updates from the patch version number. Or stricter, '0.15.0' (or 0.16.5, etc.) to lock to an exact version. |
Caused by ancient minecraft-data (0.0.1), updated to ~0.16.3, fixed above 'is not a function' error with minecraft-data but now hitting an incompatibility with mineflayer (1.5.3):
Block and Biome moved to prismarine-block and prismarine-biome in PrismarineJS/mineflayer@ca365c3 update: Block and Biome are still accessible via the mineflayer exports; fixed in d941812 mcwebchat now errors out in the browser:
dynamic require in ./node_modules/minecraft-protocol/node_modules/minecraft-data/index.js: function mcVersionToMcData(mcVersion)
{
var dir = "./minecraft-data/" + mcVersion;
return {
blocks: require(dir + '/enums/blocks'), static requires were added in PrismarineJS/node-minecraft-data@eb92ebd as of minecraft-data 0.15.0 (right after 0.14.0). minecraft-protocol 0.15.0 uses minecraft-data 0.11.0, so probably have to update straight to minecraft-protocol 0.16. |
…iome mineflayer's lib/block.js and lib/biome.js moved to separate modules, prismarine-block and prismarine-biome. Use them indirectly through mineflayer's export object instead of referencing the now-nonexistent library files. GH-19
Starting update to minecraft-protocol 0.16.6, failure on nmp0.15.0 branch is:
major change is move to use protodef, relevant commit: PrismarineJS/node-minecraft-protocol@f45c6df packet IDs also moved:
in PrismarineJS/node-minecraft-protocol@1a9e08c#diff-1fdf421c05c1140f6d71444ea2b27638L4 then to minecraft-data: PrismarineJS/node-minecraft-protocol@6b6303b#diff-1fdf421c05c1140f6d71444ea2b27638L7 |
wsmc/JavaScript server now runs, but the mcwebchat example (browserified) fails in a dynamic require:
since browserify compiles requires statically, unable to resolve at runtime: require('./minecraft-data/1.8/enums/blocks') fixed in node-minecraft-data 0.15.0: PrismarineJS/node-minecraft-data@eb92ebd - but mineflayer was using ~0.5.0. PR to mineflayer to update: PrismarineJS/mineflayer#354 gets further, until mineflayer/index.js using requireindex: var requireIndex = require('requireindex');
var plugins = requireIndex(path.join(__dirname, 'lib', 'plugins')); requireindex calls FS.readdirSync - not defined in browserify: (I thought it used to be? can be static) var files = FS.readdirSync(dir); update: https://www.npmjs.com/package/bulkify browserify transform brfs transform supports fs.readdirSync: browserify/brfs#19 (PR merged) |
For supporting requireindex in mineflayer, see porting progress #19
Added brfs transform but now running into https://github.com/rom1504/node-mojangson browserify incompatibility:
unable to repro in isolation ( https://github.com/substack/static-eval/blob/c702b3e00091e0d351303796ff41c991e7babe62/index.js#L89 - static-eval walking CallExpression else if (node.type === 'CallExpression') {
var callee = walk(node.callee);
if (callee === FAIL) return FAIL;
var ctx = node.callee.object ? walk(node.callee.object) : FAIL;
if (ctx === FAIL) ctx = null;
var args = [];
for (var i = 0, l = node.arguments.length; i < l; i++) {
var x = walk(node.arguments[i]);
if (x === FAIL) return FAIL;
args.push(x);
}
return callee.apply(ctx, args);
} the callee is an object: ah, node-mojangson has a dynamic readFileSync in the generated grammar.js:
but this shouldn't crash. Proposed a fix in static-eval (-> static-module -> static-module -> brfs): browserify/static-eval#12 Fix exception instead of failure when parsing CallExpressions and removing the affected (unused) unbrowserifiable code in node-mojangson: |
mojangson 0.2.2 is in mineflayer 2570e20, testing with it able to brfs global transform now with no parse error - but the transformed requireindex crashes here:
with no defined 'FS' (?) - this likely cannot be statically replaced. But mineflayer has had:
for a while, since at least PrismarineJS/mineflayer@bd4eba1 - not sure how I had this working in browserify previously |
Mineflayer plugins were statically require()'d in wsmc/mineflayer-stream.js: Lines 8 to 31 in 57ceb6a
This puts browserified mineflayer in a bit of a pickle:
I think any solution will require changes to mineflayer, but I'm not sure what is the correct fix going forward. Some ideas:
update: above mineflayer change works, PR'd for consideration: PrismarineJS/mineflayer#356
|
After solving the above issue, next step is to update wsmc/minecraft-protocol-stream.js for the changes in node-minecraft-protocol/createClient.js. |
Current status: wsmc runs, but on ws connection, logs a bunch of errors (probably not transitioning states correctly — the ws is supposed to mainly be in the PLAY state):
no chat messages received, attempting to send a message in mcwebchat fails with: WebSocket error: Error: Serialization error for .toServer : SizeOf error for name : chat is not in the mappings value stack trace points to ProtoDef but doesn't say where it is called: exception.stack |
"chat is not in the mappings value" means it's not in the correct state indeed. That error definitely doesn't say enough though. |
I think that's happening somewhere you do a .write('chat',...) and you are not in PLAY state. |
It's throwing the exception here:
Receiving the if (state !== 'play' && state !== 'login') {
console.log('Skipping state '+state+' packet: ',buffer);
return;
}
|
Tracking further updates in the pull request: #21 |
Using the latest releases minecraft-protocol 0.16.5 and mineflayer 1.5.3, wsmc fails with:
The text was updated successfully, but these errors were encountered: