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

Update book write/sign packet for 1.20.5+ #3495

Open
1 task done
usamiername opened this issue Nov 5, 2024 · 0 comments · May be fixed by #3496
Open
1 task done

Update book write/sign packet for 1.20.5+ #3495

usamiername opened this issue Nov 5, 2024 · 0 comments · May be fixed by #3496
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

@usamiername
Copy link

usamiername commented Nov 5, 2024

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

Versions

  • mineflayer: latest
  • server: 1.21
  • node: 18

Detailed description of a problem

The book write/sign packet was changed in 1.20.5, therefore the solution between 1.18-1.20.4 does not work.

Your current code

const mineflayer = require("mineflayer")

const bot = mineflayer.createBot({
	host: "localhost",
	username: "username",
	port: 25567
})

bot.on("chat", (username, message) => {
	if (message === "book") {
		let inventory = bot.inventory;
		for (let i = 0; i < inventory.slots.length; i++) {
			if (inventory.slots[i]) {
				if (inventory.slots[i].type === 1091) {
					bot.equip(inventory.slots[i], "hand");
					bot.writeBook(bot.quickBarSlot + 36, ["test"]);
				};
			};
		};
	};
})

bot.on("kicked", console.log)
bot.on("error", console.log)

Expected behavior

When book is typed in the chat, the bot should equip a book and write a page containing "test" to it.

Actual behavior

The program will error and shut down with the message "TypeError: SizeOf error for undefined : Cannot read properties of undefined (reading 'length')"

@usamiername usamiername 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 Nov 5, 2024
@u9g u9g linked a pull request Nov 8, 2024 that will close this issue
@u9g u9g linked a pull request Nov 8, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant