-
Notifications
You must be signed in to change notification settings - Fork 2
Task System en
Tasks are where AIBot actually "gets hands-on". Each task is a self-contained state machine: it takes parameters, drives itself forward, has its own timeout / stuck watchdog, and ends in COMPLETED or FAILED.
-
Task/AbstractTask— the task interface and base class. Subclasses implementonStart/onTick/onAbortand finish viacomplete()/fail(reason). -
TaskState—RUNNING·COMPLETED·FAILED, etc. -
TaskManager— one active task per bot; handlesassign/abort/tickAll. -
BotTickCoordinator— the per-tick scheduler: safety net first, then Goal Engine / task progress, then idle coordination. See Safety Net.
G1 — self-contained tasks. A task never assigns sub-tasks; it calls shared primitives (
BlockMiner,DigNav,ActionPack,HarvestCore). No "state machine inside a state machine" fighting for control.
G2 — main-thread execution. All task logic runs on the server main thread for thread-safe world access.
Stationary tasks (mining, descending — the bot barely moves) override isWaiting() to return true, telling the global StuckWatcher "I'm working, not stuck". They rely on their own NO_PROGRESS / timeout watchdog instead — avoiding false kills by the coarse "position/progress unchanged = stuck" monitor.
The task package has 44 classes — about 30 concrete task state machines plus the base class, manager, coordinators and watchdogs.
| Task | Description |
|---|---|
MoveTask |
Pathfind to a coordinate; falls back to dig-through when blocked (safely bails on water / attack) |
FollowTask |
Follow a player |
GuardTask |
Guard a point / person |
| Task | Description |
|---|---|
MineTask |
Mine an exposed target block |
OreDigTask |
Targeted ore mining, with prospecting + vein clearing |
StripMineTask |
Strip mining |
DescendToYTask |
Staircase-descend to a target Y |
DigDownTask |
Staircase downward mining (never straight down) |
| Task | Description |
|---|---|
GatherQuotaTask |
Gather to a quota, with long-range tree prospecting + roaming |
ForageTask |
Forage |
FarmTask |
Plant / harvest crops |
BreedTask |
Breed animals |
FishTask |
Fish |
| Task | Description |
|---|---|
CraftTask |
Craft (expands by actual materials, e.g. any-log → planks) |
SmeltTask |
Furnace smelting (with fuel fetch / walk-to-furnace fallback) |
| Task | Description |
|---|---|
CombatTask (+CombatCore) |
Melee with line-of-sight checks |
HuntTask |
Hunt for meat |
EvadeTask |
Retreat / flee |
EatTask |
Eat |
SleepTask |
Sleep |
LightAreaTask |
Torch an area |
EmergencyShelterTask |
Emergency wall-up |
| Task | Description |
|---|---|
BuildTask |
Build from a blueprint |
PlaceStationsTask |
Place workstations |
ContainerTask |
Container deposit / withdraw |
StockpileTask |
Stockpile & organize |
ResupplyTask |
Resupply |
TradeTask |
Villager trading |
HoldTask |
Stand by |
TaskManager · BotTickCoordinator · StuckWatcher · DangerWatcher · NavSafetyNet — see Safety Net.
Further reading: Goal Engine (who dispatches these) · Safety Net (who backstops) · Architecture
AIBot · GitHub · MIT License · LLM plans · Tasks execute · Bob survives
新手上路
理解原理
参与开发
- Home
- Getting Started
- Commands
- Configuration
- Client Panel
- Architecture
- Goal Engine
- Task System
- Brain & Tools
- Safety Net
- Developer Guide
- FAQ
主仓库 · MIT