Skip to content

fix: handle equipped items in inventory actions - #809

Open
tylergibbs1 wants to merge 1 commit into
mindcraft-bots:developfrom
tylergibbs1:fix/800-equipped-item-actions
Open

fix: handle equipped items in inventory actions#809
tylergibbs1 wants to merge 1 commit into
mindcraft-bots:developfrom
tylergibbs1:fix/800-equipped-item-actions

Conversation

@tylergibbs1

Copy link
Copy Markdown

summary

findInventoryItem only searches regular player inventory slots, so discard, giveToPlayer, and putInChest treated armor and offhand items as missing.

This change:

  • checks armor and offhand slots when regular inventory has no match
  • discards from the exact matched slot, including partial equipped stacks
  • moves equipped items back into regular inventory before a chest deposit
  • stops safely when the inventory has no room instead of dropping equipped gear

Closes #800

testing

  • node --check src/agent/library/skills.js
  • exercised the exported discard and putInChest functions with mocked offhand inventory
  • verified a partial offhand discard and a complete offhand chest deposit
  • verified chest deposit fails safely when normal inventory is full
  • git diff --check

I did not run a live Minecraft session or ESLint because this sparse checkout does not have the project dependencies installed.

Discarding and chest deposits only searched regular inventory slots, so armor and offhand items were reported missing. Search equipment as a fallback, transfer from the exact slot, and safely unequip items before chest deposits.
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

Successfully merging this pull request may close these issues.

Problem about Items Putting

1 participant