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

Equip the not equipment type item to equipment slot and able update bot.inventory. #3515

Open
1 task done
SmileYik opened this issue Dec 2, 2024 · 4 comments
Open
1 task done
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

@SmileYik
Copy link

SmileYik commented Dec 2, 2024

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

Versions

  • mineflayer: lasted
  • server: vanilla 1.12.2
  • node: lasted

Detailed description of a problem

I am using mineflayer control bot's inventory, and I want to swap the item to the equipment slot. i found the methods "bot.equip" and "bot.moveSlotItem", i tried these method to equip equipment and it's worked.
After that I try equip an Apple to feet by these method, and both worked, the bot.inventory been updated and the window fired a updateSlot event. But it should not be happend. I logout and login server again, the Apple still in my inventory, but not in equipment slot. The bot.inventory should be sync to server's.

This screenshot shows that i equipped a steak. ( The left and right vertical line is the equipment slot. the bottom is quick bar, middle is storage)
image

What did you try yet?

I tried to find the same question in issues, but because my bad english did not find the same issue(may be my searched keyword is wrong).

Your current code

I am using python to write this, like the upper picture, the item will updated by window's updateSlot event.

i made a simpe console to eval python code. like code: print(self.bot.inventory) , self.bot.equip(self.bot.inventory.slots[9], "feet") and self.bot.moveSlotItem(9, 8).

Expected behavior

I think the bot.inventory should be sync to server's. should not update and equip Apple to the equipment slot.

Additional context

I am using Python to write a mineflayer application.

@SmileYik SmileYik 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 Dec 2, 2024
@Pix3lPirat3
Copy link
Contributor

Did you disable requiresConfirmation at all? I would think the confirmTransaction system would've handled that, unless equip bypasses the system entirely

@SmileYik
Copy link
Author

SmileYik commented Jan 8, 2025

Did you disable requiresConfirmation at all? I would think the confirmTransaction system would've handled that, unless equip bypasses the system entirely

I think maybe not, I just require mineflayer and use it directly. To temporarily avoid this situation, I write a function to avoid swap items between equipment slots and other slots.

How to enable requireConfirmation?I can not find it in api document, I browse some other's demo and not see that, maybe I was missed it.

@Pix3lPirat3
Copy link
Contributor

Did you disable requiresConfirmation at all? I would think the confirmTransaction system would've handled that, unless equip bypasses the system entirely

I think maybe not, I just require mineflayer and use it directly. To temporarily avoid this situation, I write a function to avoid swap items between equipment slots and other slots.

How to enable requireConfirmation?I can not find it in api document, I browse some other's demo and not see that, maybe I was missed it.

requiresConfirmation is part of the Window object, which is Inventories (prismarine-windows repo)

@SmileYik
Copy link
Author

Did you disable requiresConfirmation at all? I would think the confirmTransaction system would've handled that, unless equip bypasses the system entirely

I think maybe not, I just require mineflayer and use it directly. To temporarily avoid this situation, I write a function to avoid swap items between equipment slots and other slots.
How to enable requireConfirmation?I can not find it in api document, I browse some other's demo and not see that, maybe I was missed it.

requiresConfirmation is part of the Window object, which is Inventories (prismarine-windows repo)

I found it, and i think i'm not disable it. I just directly use bot.inventory to control bot's inventory. I see the requiresConfirmation is default enable in Window class constructor, and not set other value in inventory.js

bot.inventory = windows.createWindow(0, 'minecraft:inventory', 'Inventory')

https://github.com/PrismarineJS/prismarine-windows/blob/6280c5b9a9b3034cf02c7f851c2dd19c351c9f57/lib/Window.js#L6-L9

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