Skip to content

Conversation

@atiweb
Copy link

@atiweb atiweb commented Jan 13, 2026

Summary

This PR introduces several survival improvements and quality-of-life features for the Mindcraft bot.

New Features

1. Survival Modes (src/agent/modes.js)

  • auto_eat: Automatically eats food when hunger drops to 15 or below
  • auto_sleep: Sleeps at night to avoid monster spawns
  • fall_protection: MLG water bucket placement when falling from heights

Helper functions added:

  • isNightTime() - Detects Minecraft night time
  • getBestFood() - Selects best available food item
  • getSafeEscapePosition() - Finds safe landing spots

2. !autoCraft Command (src/agent/commands/actions.js)

Intelligent automated crafting that handles full crafting chains:

  • Tools: pickaxe, axe, shovel, hoe, sword (wood → stone → iron → diamond)
  • Armor: helmet, chestplate, leggings, boots
  • Other: beds, boats, torches, ladders, redstone items

Features:

  • Automatic material detection and gathering
  • Crafting chain resolution (logs → planks → sticks → tools)
  • Progress feedback during crafting
  • Wood type selection based on available materials

3. Improved Queries (src/agent/commands/queries.js)

  • Inventory display sorted by quantity (descending)
  • Craftable items categorized by type (tools/weapons/armor/blocks/other)
  • Added crafting hints for common recipes

4. Enhanced Skills (src/agent/library/skills.js, src/agent/library/world.js)

  • Better error handling for edge cases
  • Improved block placement strategies
  • Enhanced pathfinding and movement
  • More robust crafting operations

5. Paper Server Stability (src/utils/mcdata.js)

  • Position packet throttling (50ms) to reduce server load
  • Suppressed PartialReadError for non-critical packets
  • Better connection timeout handling
  • More graceful error recovery

6. Minor Fix (src/agent/agent.js)

  • Handle empty tab-only responses to prevent unnecessary processing

Testing

  • Tested on Paper server 1.21.1
  • Tested survival gameplay with auto modes enabled
  • Tested crafting chains for various items

Related Issues

This PR may help address:


Changes: 7 files, +1682/-119 lines

- auto_eat: automatically eat when hunger <= 15
- auto_sleep: sleep at night to avoid monsters
- fall_protection: MLG water bucket placement when falling
- Helper functions: isNightTime(), getBestFood(), getSafeEscapePosition()
- Improved mode documentation and hints
- Intelligent crafting chains (logs -> planks -> sticks -> tools)
- Support for tools, weapons, armor, beds, boats, redstone items
- Material detection and automatic gathering
- Progress feedback during crafting
- Wood type selection based on available materials
- Sort inventory display by quantity (descending)
- Categorize craftable items (tools/weapons/armor/blocks/other)
- Add crafting hints for common recipes
- Better formatting for readability
Skills improvements:
- Better error handling for edge cases
- Improved block placement strategies
- Enhanced pathfinding and movement
- More robust crafting operations

World improvements:
- Better block detection
- Improved entity queries
- Enhanced position calculations
- Add position packet throttling (50ms) to reduce server load
- Suppress PartialReadError for non-critical packets
- Better connection timeout handling
- More graceful error recovery
- Treat responses containing only tab character as empty
- Prevents unnecessary processing of whitespace responses
Copilot AI review requested due to automatic review settings January 13, 2026 02:39
@atiweb
Copy link
Author

atiweb commented Jan 13, 2026

Testing Notes

These changes have been tested extensively on Minecraft 1.21.11 Java Edition for approximately 2 weeks with acceptable results.

Test Environment

The testing was performed using the following PRs that add support for Minecraft 1.21.11:

Test Results

During the 2-week testing period:

  • ✅ All survival modes (auto_eat, auto_sleep, fall_protection) functioned as expected
  • !autoCraft command successfully handled crafting chains
  • ✅ Paper server stability improvements reduced connection issues
  • ✅ Enhanced skills worked reliably in various survival scenarios

Note: Once the minecraft-data and mineflayer PRs are merged, these improvements will be fully compatible with official 1.21.11 support.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Sweaterdog
Copy link
Contributor

Seems great! I haven't tested, but looking at the README of the PR looks like you, or something working for you, added a feature already present. Agents already ate food when they were low on hunger if I am not to be mistaken. If they didn't eat before automatically, I'd be super surprised.

Great work! I like the auto crafting feature a ton.

@atiweb
Copy link
Author

atiweb commented Jan 13, 2026

@Sweaterdog Thanks for the feedback! 🙏

To clarify about auto_eat: I reviewed the codebase and there is no automatic eating functionality in the current develop branch. What exists is:

  1. skills.consume() - A manual skill that the LLM can call when prompted, but it requires explicit instruction from the user/AI to eat.

  2. self_preservation mode - Only handles drowning, burning, lava, and low health damage situations - it doesn't monitor hunger.

The new auto_eat mode I added:

  • Proactively monitors hunger (triggers at food <= 15, before starvation at 0)
  • Automatically selects the best food from inventory based on saturation priority
  • Has a 30-second cooldown to prevent spam eating
  • Interrupts non-critical actions to eat (like mining/following)
  • Works completely autonomously without LLM prompting

So this is genuinely new functionality - the agents would previously only eat if the LLM decided to call !consume or !eat, which often didn't happen reliably.

That said, if there's an existing feature I missed somewhere else in the codebase, please let me know! I did a grep search for "eat", "food", "hunger" in modes.js and skills.js and didn't find any automatic eating logic.


The main features I'm most excited about are:

  • !autoCraft command (glad you like it! 😄)
  • fall_protection (MLG water bucket)
  • Paper server stability improvements

@Sweaterdog
Copy link
Contributor

!consume Isn't a valid command, it's !eat. Also, I have no clue if you used AI to write some / all of it, but I'll be looking at the code today to put in a review either way.

Thanks for the great contributions!

@atiweb
Copy link
Author

atiweb commented Jan 14, 2026

Hi Contributor
Sweaterdog, yes, I did use AI to improve the code. I tested the project for days and was evident that some parts needed improvements, and still do!!! The aim is to mimics as better as possible normal human behavior. Just trying to help as a hobby.
Greetings.

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.

2 participants