Expected behavior
The transition between servers on 1.21+ does not work. Commands (/an /join or others) to connect to another server do not work on 1.21+, and the bot is kicked.
Additional context
Bot successfully connects to Velocity lobby
Authentication with /login works
Command /joinq is executed
The bot is kicking after entering the command.
I've tried Viaproxy,
tried adding the lines physicsEnabled: false,
tried adding the lines "
bot._client.on('start_configuration', () => { shouldUsePhysics = false })
bot._client.on('finish_configuration', () => { shouldUsePhysics = true })" i
n mineflayer/lib/plugins/physics.js
current code
const mineflayer = require('mineflayer')
const FlayerCaptcha = require('flayercaptcha')
function readArg (name) {
const i = process.argv.indexOf('--' + name)
if (i >= 0 && process.argv[i + 1]) return process.argv[i + 1]
return process.env[name.toUpperCase()]
}
function stringArg (name, def) { const value = readArg(name); return value == null ? def : value }
function numberArg (name, def) {
const value = readArg(name)
if (value == null || value === '') return def
const parsed = Number(value)
return Number.isFinite(parsed) ? parsed : def
}
const host = stringArg('host', 'play.funtime.su')
const port = numberArg('port', 25565)
const username = stringArg('username', 'example')
const version = stringArg('version', '1.21.4')
const bot = mineflayer.createBot({
host, port, username, version, auth: 'offline',
viewDistance: 32,
physicsEnabled: true
})
console.log(`[bot] Подключение к ${host}:${port} (версия ${version})`)
//
const captcha = new FlayerCaptcha(bot, { delay: 150, isStopped: false })
let awaitingCaptchaInput = false
let captchaSaved = false
captcha.on('imageReady', async ({ data, image }) => {
if (captchaSaved) return
if (data.facing !== 'forward') {
console.log(`[captcha] fake (facing = ${data.facing}) — пропускаем`)
return
}
const filename = `captcha_${Date.now()}.png`
await image.toFile(filename)
console.log(` Save: ${filename} `)
captchaSaved = true
awaitingCaptchaInput = true
})
process.stdin.on('data', (chunk) => {
const text = chunk.toString().trim()
if (!text) return
if (awaitingCaptchaInput) {
bot.chat(text)
console.log(`[send] ${text}`)
awaitingCaptchaInput = false
} else {
bot.chat(text)
console.log(`[message send] ${text}`)
}
})
bot.on('message', (jsonMsg) => {
if (awaitingCaptchaInput) return
console.log(`[chat] ${jsonMsg.toString()}`)
})
bot.on('login', () => console.log('[bot] login ok'))
bot.on('spawn', () => {
console.log('[bot] spawn')
captchaSaved = false
})
bot.on('kicked', (reason) => {
console.log(`[bot] kicked: ${reason}`)
awaitingCaptchaInput = false
})
bot.on('end', (reason) => {
console.log(`[bot] end: ${reason}`)
awaitingCaptchaInput = false
})
bot.on('error', (err) => {
console.log(`[bot] error: ${err.message || err}`)
})
Expected behavior
The transition between servers on 1.21+ does not work. Commands (/an /join or others) to connect to another server do not work on 1.21+, and the bot is kicked.
Additional context
Bot successfully connects to Velocity lobby
Authentication with /login works
Command /joinq is executed
The bot is kicking after entering the command.
I've tried Viaproxy,
tried adding the lines physicsEnabled: false,
tried adding the lines "
bot._client.on('start_configuration', () => { shouldUsePhysics = false })
bot._client.on('finish_configuration', () => { shouldUsePhysics = true })" i
n mineflayer/lib/plugins/physics.js
current code