-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fjust created by someone new to the project, we don't know yet if it deserves an implementation / a fpossible bug
Description
- The FAQ doesn't contain a resolution to my issue
Versions
- mineflayer: 4.33.0
- server: Leaf 1.21.8 behind Velocity
- node: 24.11.0
Detailed description of a problem
bot.blockAt(bot.entity.position.offset(0, -1, 0)).displayName returns 'Air' if bot's y position is below 0
What did you try yet?
Did you try any method from the API? only bot.blockAt
Did you try any example? no
Your current code
const mineflayer = require('mineflayer');
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', (line) => {
const msg = (line || '').trim();
if (!msg) return;
if (!bot || typeof bot.chat !== 'function') {
console.log('Not ready');
return;
}
if (msg === '!quit' || msg === '!exit') {
try { bot.quit(); } catch(e) {}
rl.close();
process.exit(0);
}
if (msg === '!jump') {
bot.setControlState('jump', true);
bot.setControlState('jump', false);
return;
}
if (msg === '!blockunder') {
console.log(bot.blockAt(bot.entity.position.offset(0, -1, 0)).displayName);
return;
}
if (msg === '!whereami') {
console.log(bot.entity.position);
console.log(bot.entity.world);
return;
}
try {
bot.chat(msg);
} catch (err) {
console.error(err);
}
});
const bot = mineflayer.createBot({
host: '...',
port: 25565,
version: '1.19.3',
username: '...',
auth: 'offline'
});
bot.on('message', (message) => {
console.log(message.toAnsi());
if (message.toString().toLowerCase().includes('login using /login')) {
bot.chat('/login ...');
}
});
Expected behavior
bot.blockAt should work to y -64
Additional context
I can suggest a fix, that got it to work:
in mineflayer\lib\plugins\game.js
bot.game.minY = 0
bot.game.height = 256
to
bot.game.minY = -64
bot.game.height = 320
Metadata
Metadata
Assignees
Labels
Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fjust created by someone new to the project, we don't know yet if it deserves an implementation / a fpossible bug