Open Ezcha opened 9 years ago
Pretty sure the problem doesn't come from mineflayer-scaffold. You should use https://github.com/Darthfett/mineflayer-blockfinder and not the (very basic) findBlock embedded in mineflayer.
I thought about, changed it, but I am still getting the error. https://gyazo.com/cecfb65e961751a761cb52a0ff61311f
console.log("Mine plugin started.");
var mineflayer = require('mineflayer');
var scaffoldPlugin = require('mineflayer-scaffold')(mineflayer);
var vec3 = mineflayer.vec3;
module.exports.inject = inject;
function inject(bot) {
bot.on('whisper', function (username, message) {
if (username == bot.username) return;
if (message == 'mine') {
bot.findBlock({
point: bot.entity.position,
matching: 56,
maxDistance: 256,
count: 1,
}, function(err, blockPoints) {
if (err) {
console.log('Error trying to find Diamond Ore: ' + err);
}
if (blockPoints.length) {
console.log('I found a Diamond Ore block at ' + blockPoints[0].position + '.');
var tempVar = blockPoints[0].position
bot.scaffold.to(tempVar);
} else {
console.log("I couldn't find any Diamond Ore blocks within 64.");
}
});
}
});
}
Help? Most of the time my simple code doesn't run!
Getting the same problem. Code:
var mineflayer = require('mineflayer');
var navigatePlugin = require('mineflayer-navigate')(mineflayer);
var scaffoldPlugin = require('mineflayer-scaffold')(mineflayer);
var bot = mineflayer.createBot({
host: "localhost",
port: 25565,
username: "Notch"
});
navigatePlugin(bot);
scaffoldPlugin(bot);
bot.on('chat', function(username, message) {
if (username === bot.username) return;
if (message.match(/^!echo .*/)) {
bot.chat(message.substring(6));
} else if (message.match(/^!come$/)) {
bot.scaffold.to(bot.players[username].entity.position, function(err) {
if (err) {
bot.chat("didn't make it: " + err.code);
} else {
bot.chat("made it!");
}
})
}
});
Every now and then it makes it the whole way... but most of the time it crashes. Here is the log.
/Users/perry/tmp/node_modules/mineflayer/lib/plugins/blocks.js:134
block.signText = signs[loc.floored];
^
RangeError: Maximum call stack size exceeded
at Bot.blockAt (/Users/perry/tmp/node_modules/mineflayer/lib/plugins/blocks.js:134:27)
at moveInDirection (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:272:21)
at Object.decreaseX (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:114:7)
at changeState (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:249:25)
at improveX (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:260:42)
at Object.improvePosition (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:106:7)
at changeState (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:249:25)
at moveInDirection (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:283:7)
at Object.decreaseX (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:114:7)
at changeState (/Users/perry/tmp/node_modules/mineflayer-scaffold/index.js:249:25)
A quick fix would be to add the --stack-size=value parameter when running node
node --stack-size=6000 file.js
You might need to adjust the 6000
Ah this is a bummer 😕
It seems that the project is on my old laptop. I do remember trying to increase the stack size, to no success. I might try getting mineflayer set up again, but the project doesn't seem to be maintained anymore.
I could replicate this bug, increasing stack-size
does not fix it, it even seg faulted when stack size was too high.
I suggest opening an issue on the right repo which is https://github.com/Darthfett/mineflayer-blockfinder
that error is unrelated with scaffold.
oh and you are doing https://github.com/Darthfett/mineflayer-blockfinder/pull/16/files of course right ?
It is related with scaffold, I am not even using bot.findBlock(), just bot.scaffold.to(). I was able to fix this by manually applying #4
I don't know if this is my code or the scaffold's code, butmost of the time when I execute the script below I get a "RangeError: Maximum call stack size exceeded" error. It works occasionally.