From 083f9c4c5eda7612c9b1599bf65d74e04fe50988 Mon Sep 17 00:00:00 2001 From: GenerelSchwerz Date: Fri, 23 Feb 2024 16:27:27 -0500 Subject: [PATCH] yep --- docs/API.md | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/docs/API.md b/docs/API.md index 9e26566..fbdbaa9 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,6 +1,17 @@

Table of contents

- [Pathfinder](#pathfinder) +- [Types](#types) + - [Abstract](#abstract) + - [Path](#path) + - [PathStatus](#pathStatus) + - [PathGenerator](#pathGenerator) + - [PathGeneratorResult](#pathGeneratorResult) + - [Mineflayer-Specific](#mineflayer-specific) + - [Path](#path) + - [PathGenerator](#pathGenerator) + - [PathGeneratorResult](#pathGeneratorResult) + - [ResetReason](#resetReason) - [Goals](#goals) - [GoalBlock](#goalblock) - [GoalNear](#goalnear) @@ -41,6 +52,44 @@ await bot.pathfinder.goto(GoalBlock.fromVec(0,0,0)) ``` + +

Types

+ +

PathStatus

+ +The status of a path. String value. + +| Value | Description | +| --- | --- | +| `success` | The path was successful. | +| `partial` | The path is partial. | +| 'partialSuccess' | The path is partial, but this section will be used to get to the goal. | +| `noPath` | No path was found. | +| `timeout` | The pathfinder timed out. | + + +

PathGenerator

+ +An async generator that generates partial paths until a successful path is found, or no path is found. + +| Method | Description | +| --- | --- | +| `next() => Promise` | Returns a promise that resolves to the next path result. | + + +

PathGeneratorResult

+ +The result of a path generator. + +| Property | Type | Description | +| --- | --- | --- | +| `result` | [Path](#path) | The result of the path. | +| `astarContext` | AStar | The astar context. | + + + + +

Goals

GoalBlock

@@ -219,3 +268,95 @@ export interface MovementOptions { + +

goalSet

+ +Fired when a new goal is set. + +

Arguments

+ +| Parameter | Type | +| --- | --- | +| goal | goals.Goal | + + +

Example

+ +```ts +bot.on('goalSet', (goal) => { + console.log(`New goal set: ${goal}`) +}) +``` + +

goalFinished

+ +Fired when a goal is finished. + +

Arguments

+ +| Parameter | Type | +| --- | --- | +| goal | goals.Goal | + +

Example

+ +```ts +bot.on('goalFinished', (goal) => { + console.log(`Goal finished: ${goal}`) +}) +``` + +

goalAborted

+ +Fired when a goal is aborted. + +

Arguments

+ +| Parameter | Type | +| --- | --- | +| goal | goals.Goal | + +

Example

+ +```ts +bot.on('goalAborted', (goal) => { + console.log(`Goal aborted: ${goal}`) +}) +``` + +

enteredRecovery

+ +Fired when the bot enters recovery mode. + +

Example

+ +```ts +bot.on('enteredRecovery', () => { + console.log(`Entered recovery mode`) +}) +``` + +

exitedRecovery

+ +Fired when the bot exits recovery mode. + +

Example

+ +```ts +bot.on('exitedRecovery', () => { + console.log(`Exited recovery mode`) +}) +``` + +

resetPath

+ +Fired when the bot resets the path. + +

Arguments

+ +| Parameter | Type | +| --- | --- | +| reason | [ResetReason](#resetReason) | + + +