Skip to content
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

The value of "offset" is out of range. #2891

Closed
1 task done
EaterAS opened this issue Jan 9, 2023 · 7 comments
Closed
1 task done

The value of "offset" is out of range. #2891

EaterAS opened this issue Jan 9, 2023 · 7 comments
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@EaterAS
Copy link

EaterAS commented Jan 9, 2023

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 1.8.9
  • server: vanilla/spigot/paper #.#.#
  • node: 18

Detailed description of a problem

I have a faction bot running on the server and it shows the offset error everytime i try to move to a different location and even if it don't move it, after some time it will show the error regardless. This only seems to happen when the account has a rank.

What did you try yet?

I am not really sure what to try

Did you try any method from the API?
No

Did you try any example? Any error from those?
No

Your current code

var bot = mineflayer.createBot(b);
bindEvents(bot);

function bindEvents(bot) {
    bot.once('login', () => {
        database.toggleBotRestarting(false);
        bot.settings.viewDistance = 'tiny';
        bot.settings.colorsEnabled = false;

        console.log(bot.username + ' has connected to ' + config.serverip + '.')
        bot.chat('/login ' + config.password)
        options.wait(options.minuteToMS / 12).then(() => {
            bot.chat(database.getString('joincmd'));
        })
    });

    bot.on('kicked', (reason, loggedIn) => {
        console.log(reason, loggedIn);
        serverChat.push(JSON.parse(reason).text.replace(/\u00A7[0-9A-FK-OR]/ig, ''));
        bot.quit();
    });

    bot.on('end', () => {
        restart();
    });

    bot.on('error', (err) => { console.log(err) });
};

Additional context

This is the error i get

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 10239. Received 11629
    at new NodeError (node:internal/errors:393:5)
    at boundsError (node:internal/buffer:86:9)
    at Buffer.readUInt8 (node:internal/buffer:252:5)
    at readUInt4LE (/home/container/node_modules/uint4/index.js:23:23)
    at writeUInt4LE (/home/container/node_modules/uint4/index.js:34:28)
    at Section.setSkyLight (/home/container/node_modules/prismarine-chunk/src/pc/1.8/section.js:123:5)
    at Chunk.setSkyLight (/home/container/node_modules/prismarine-chunk/src/pc/1.8/chunk.js:145:33)
    at Chunk.setBlock (/home/container/node_modules/prismarine-chunk/src/pc/1.8/chunk.js:79:42)
    at Client.<anonymous> (/home/container/node_modules/mineflayer/lib/plugins/blocks.js:406:12)
    at Client.emit (node:events:513:28) {
  code: 'ERR_OUT_OF_RANGE'
} uncaughtException
@EaterAS EaterAS added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Jan 9, 2023
@EaterAS
Copy link
Author

EaterAS commented Jan 9, 2023

https://pastebin.com/RGzPXwYn

This is what i got from minecraft-protocol debugging

@CZakarya
Copy link

Having a specific function for "binding events" is undesirable and will often break with namespaces. I know it seems like a good idea to separate it, but it makes things harder down the road with code complexity. You are also calling the bindEvents function before defining it. This may work with the specific JavaScript interpreter you are using, but most interpreters will throw an undefined error.

@EaterAS
Copy link
Author

EaterAS commented Jan 25, 2023

Having a specific function for "binding events" is undesirable and will often break with namespaces. I know it seems like a good idea to separate it, but it makes things harder down the road with code complexity. You are also calling the bindEvents function before defining it. This may work with the specific JavaScript interpreter you are using, but most interpreters will throw an undefined error.

dont think thats the reason for the error, it shows that even with a normal bot

@MightyPiggie
Copy link

Are you in the nether by any change? There seem to a issue on 1.8 with block updates:
#2614

@extremeheat
Copy link
Member

Dupe #2614

@EaterAS
Copy link
Author

EaterAS commented Jan 29, 2023

Are you in the nether by any change? There seem to a issue on 1.8 with block updates: #2614

nope, just normal overworld i believe

@WuJinAiWan
Copy link

This may be caused by the distance My robot is getting this error at about 2,000,000 grids

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

5 participants