Root cause: Bedrock sends inventory_content with window_id as string
("inventory", "armor", "offhand") but bot.inventory has numeric id 0.
The getWindow() lookup failed silently, so inventory was never populated.
Fix: check for string window_id values and map them to bot.inventory
directly, bypassing the numeric ID lookup.
This fixes:
- bot.inventory.items() returning empty
- Auto-equip not detecting items
- "item not in inventory" errors for equip commands
- Inventory check command returning empty
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Bedrock server requires the animate packet to have
has_swing_source=true and swing_source='attack' for the
inventory_transaction attack to actually deal damage.
Without this, the server accepts the packets silently but
never registers the hit. This was discovered by monitoring
what a real client sends vs what our bot sends.
Confirmed: skeleton took damage 20 → 19 → 18 → 17 HP
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
COMBAT:
- Fixed attack serialization: proper heldItemToNotch() for empty hand
- Attack now looks at target before swinging (server validates aim)
- Player position includes eye height in attack packet
- Click position calculated relative to target entity
INTELLIGENCE (complete rewrite):
- NeedsSystem: Sims-like needs (safety, hunger, social, shelter, boredom)
that decay over time and drive behavior priorities
- GoalManager: Long-term goals broken into steps (gather_wood,
explore_area, find_food, check_container, go_home)
- SpatialMemory: Remembers locations of containers, crafting tables,
interesting blocks, and home position
- DailyRoutine: Morning/day/evening/night phases with trait-influenced
activity selection
- Brain now WAITS for tasks to complete instead of piling on new ones
- Goal-based decision making replaces random wander
OLLAMA:
- Pre-warm model on deploy (loads into GPU before first chat)
- Keep-alive pings every 2 minutes (prevents model unload)
- Adaptive timeouts: 60s cold, 15s warm, 90s retry
- Auto-retry on timeout failure
CRAFTING:
- Quantity parsing ("craft 5 sticks", "craft a wooden pickaxe")
- Number words supported ("craft three planks")
- Smarter item name extraction with preposition stopping
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The inventory_transaction packet for attacks includes held_item.
When Doug has nothing in his hand, bot.heldItem is null, causing
"Cannot read properties of null (reading 'network_id')".
Fix: provide a proper empty item object with network_id=0 when
heldItem is null. Attacks now send successfully.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Listen on raw 'text' packet for Bedrock chat (pattern-based chat event
doesn't fire reliably on Bedrock)
- Brain: add safety reset for stuck pending_status flag
- MariaDB: add retry-on-disconnect for all query methods
- Suppress harmless punycode deprecation warning from Node.js
- Add mineflayer-bedrock lib packages (mineflayer, prismarine-chunk,
prismarine-registry) for movement support
- Exclude minecraft-data from git (278MB, installed via npm)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>