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

minecraft-protocol error #3451

Open
1 task
lucia-developer opened this issue Sep 1, 2024 · 2 comments
Open
1 task

minecraft-protocol error #3451

lucia-developer opened this issue Sep 1, 2024 · 2 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

@lucia-developer
Copy link

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

Versions

  • mineflayer: latest
  • server: vanilla/spigot/paper 1.12.2-1.21
  • node: v18.20.3

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible.
What are you building? What problem are you trying to solve?

I'm trying to connect a bot to a server, make it run a command, and send a message to the chat (this is future, the current problem is connecting the bot). The problem is when I connect the bot I get a weird error:

What did you try yet?

Did you try any method from the API?
Did you try any example? Any error from those?

I tried examples, none worked, same error.

Your current code

const mineflayer = require('mineflayer')
const { mineflayer: mineflayerViewer } = require('prismarine-viewer')
const bot = mineflayer.createBot({
  host: 'ip-redacted',
  username: 'username',
  auth: 'offline',
  port: 25565,
  version: "1.20.2",

})

bot.on('chat', (username, message) => {
  if (username === bot.username) return
  bot.chat(message)
})

bot.once('spawn', () => {
    mineflayerViewer(bot, { port: 3007, firstPerson: false })
  })
bot.on('kicked', console.log)
bot.on('error', console.log)

Expected behavior

A clear and concise description of what you expected to happen.

The bot joins the server and I get the view from prismarine-viewer.

Additional context

Add any other context about the problem here.
The error is this one:

(bot connects)
ChatMessage {
  json: { text: '' },
  warn: [Function: debug] {
    namespace: 'minecraft-protocol',
    useColors: true,
    color: 3,
    extend: [Function: extend],
    destroy: [Function: deprecated],
    enabled: [Getter/Setter],
    inspectOpts: {}
  },
  text: '',
  bold: undefined,
  italic: undefined,
  underlined: undefined,
  strikethrough: undefined,
  obfuscated: undefined,
  color: undefined
}

(exits program/script)
@lucia-developer lucia-developer 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 Sep 1, 2024
@mdmanl
Copy link

mdmanl commented Sep 24, 2024

Mineflayer doesn't support 1.21, expected behaviour.

@spamshaker
Copy link

any alternatives to just run the LAN game and start writing the code without such headaches?

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

3 participants