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

Bot timing out when server has specified resourcepack #3317

Closed
1 task done
TerminalCalamitas opened this issue Feb 28, 2024 · 2 comments
Closed
1 task done

Bot timing out when server has specified resourcepack #3317

TerminalCalamitas opened this issue Feb 28, 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

@TerminalCalamitas
Copy link
Contributor

TerminalCalamitas commented Feb 28, 2024

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

Versions

  • mineflayer: 4.20.0
  • server: vanilla/spigot/paper 1.20.4
  • node: 20.10.0

Detailed description of a problem

When connecting to a 1.20.4 server, if the server has a specified resource pack, the bot doesn't spawn and times out.

What did you try yet?

Did you try any method from the API?
I tried using the bot.denyResourcePack() and bot.acceptResourcePack() methods, but those didn't work.
Did you try any example? Any error from those?
The resourcepack example is also unable to join the server.

Your current code

My code is really large, so this is just a small section.

console.log("Loading Options")
// Will load options from runtime args or if they don't exist, load from the config
var options = {
    host: process.argv[3] || config.bot.host,
    port: parseInt(process.argv[4]) ||config.bot.port,
    username: process.argv[2] || config.bot.username,
    auth: process.argv[5] || config.bot.auth,
    version: "1.20.4",
    checkTimeoutInterval: 32*1000
}

//Simple logging for debuging in case a bot isn't launching
console.log("Creating bot")
var bot = mineflayer.createBot(options)
console.log("Loading plugins")
bot.loadPlugin(autoeat)
console.log("Loading plugins.")
bot.loadPlugin(pathfinder)
console.log("Loading plugins..")
bot.loadPlugin(pvp)
console.log("Loading plugins...")
bot.loadPlugin(armormanager)
console.log("Plugins Loaded")

bot.on('resourcePack', () => { // Code from the resourcePack example
  bot.denyResourcePack()
})

bot.on("spawn", () => {
  console.log(`(${bot.username}) running Minecraft-DJ-Bot v${botVersion} logged in!`)
  if (config.startup.active) {
    for (let i = 0; i < config.startup.messages.length; i++) {
      bot.chat(config.startup.messages[i])
    }
  }
  cmd_handler.load()

Expected behavior

In this code the bot should output:

Creating bot
Loading plugins
Loading plugins.
Loading plugins..
Loading plugins...
Plugins Loaded
(${bot.username}) running Minecraft-DJ-Bot v${botVersion} logged in!

But the code gets stuck at Plugins Loaded, then times out.

Additional context

No matter what code examples I run the bot won't connect to a server with a specified resource pack. I've attached a file with the debug output of the bot execution that also has the error that appears in the server console when the bot times out, in case that's helpful.
BotTimeOut.log

@TerminalCalamitas TerminalCalamitas 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 Feb 28, 2024
@wgaylord
Copy link
Contributor

wgaylord commented Feb 28, 2024

Looks like the resource pack plugin needs to be updated to support the new add_resource_pack packet which allows a server to use multiple resource packs. May also want to add support for the remove_resource_pack packet in that as well. (Keep track of enabled resource packs?)

@TerminalCalamitas
Copy link
Contributor Author

I'm willing to update the resource_pack.js plugin, but before I do stuff, is there a recommended way to write the plugins? I ask since I'm unfamiliar with how the events get defined.

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

2 participants