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 supported version, and command. #561

Open
NoHaije opened this issue Jan 1, 2025 · 4 comments
Open

Minecraft supported version, and command. #561

NoHaije opened this issue Jan 1, 2025 · 4 comments

Comments

@NoHaije
Copy link

NoHaije commented Jan 1, 2025

Hello, i am using the bedrock-protocol library to create a bot for Minecraft Bedrock. However, I encountered an issue while trying to connect to a server running version 1.20.51. The client throws the following error:

Error: Unsupported version 1.20.51

Could you please confirm if this version is supported by the library? If not, could you provide an estimated timeline for its support or suggest a workaround?

Additionally, I would like to know how the bot can execute commands after connecting to the server. I attempted to send a command to the server using the client.queue method, but it does not work—the command is either not sent or not recognized by the server. Below is the example code I am using, but it does not work, and the command is not executed:

const { createClient } = require('bedrock-protocol');

const client = createClient({
  host: '...',
  port: ...,
  username: '...',
  offline: false,
  flow: 'live'
  version: '1.20.51' // I manually set this version
});

client.on('spawn', () => {
  console.log('Bot connected to the server');
  // Attempting to execute a command
  client.queue('text', {
    type: 'chat',
    message: '/say test,
  });
});

client.on('error', (err) => {
  console.error('Client error:', err);
});

I would appreciate clarification on the following points:

  1. How can I correctly send and execute commands on the server?
  2. Is version 1.20.51 supported? If not, will support be added in the future?

Thank you for your time and assistance!
Best regards,
NoHaije So1o.

@extremeheat
Copy link
Member

There is no need to specify the version in the createClient options. The library will figure out the correct version on its own. That said, if you do explicitly put in the version it must be one of the versions listed under bedrock here - https://prismarinejs.github.io/minecraft-data/

1.21.50 is currently supported; if you get errors on servers running this then you need to update your dependencies with npm update.

@Slauh
Copy link
Contributor

Slauh commented Jan 1, 2025

The commend is not sending because you did not send it right also you do not send commands with text is it another packet command_request and you are setting it to offline while setting a flow for no reason

@NoHaije
Copy link
Author

NoHaije commented Jan 2, 2025

Slauh, can you give me an example of the correct code?

@extremeheat
Copy link
Member

Try connecting to the server via the bedrock-protocol Relay (see the example) and logging out what a vanilla client sends to the server when you manually send the command.

  const relay = new Relay({
    logging: true // enable logging to terminal
    ...(rest of arguments)
  })
  relay.conLog = console.debug
  relay.listen()

You can pipe the output of the terminal to a file for easier viewing of the packet logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants