Closed Dids closed 11 years ago
I'll take a look. This is likely to be fixed this week as we upgrade to node v0.10 and minecraft protocol 1.5
I'm not good at JavaScript, but it seems that nibbleIndex
is a floating point value when buffer.readUInt8
requires an unsigned integer value as parameter. I just edited mineflayer/lib/plugins/blocks.js
and set nibbleIndex
to zero (at lines 109 and 146). But to fix this properly I think you need to use Math.floor
or some shit.
Yeah I noticed this too. I want to double check the math and the protocol to make sure we're calculating nibbleIndex correctly.
Is there a good reference page for the Minecraft multiplayer protocol?
wiki.vg/Protocol
adding Math.floor at line 109 and 146 of lib/plugins/blocks.js seems to solve this
I wonder if this will be solved by https://github.com/joyent/node/pull/5226
@superjoe30 no sorry. that PR fixes an assertion check that ensures you don't write beyond the buffer length. Right now it requires that input values are of type uint
(coercion isn't done automatically at the moment). This can be done in one of the following ways: Math.floor(val)
, ~~val
or val|0
.
fixed by zuazo's pull request, released in 0.1.0
Getting this constantly, with the latest mineflayer and 1.4.7 server:
buffer.js:577 throw new RangeError('offset is not uint'); ^ RangeError: offset is not uint at checkOffset (buffer.js:577:11) at Buffer.readUInt8 (buffer.js:585:5)