Skip to content

API reference / @jsprismarine/client / Bot

Class: Bot ​

Defined in: client/src/bot/Bot.ts:35

One synthetic player: a client, a position it believes in, and the behaviors driving it.

The position is the bot's own rather than the client's because the client core has no game state layer yet - it knows where it started, from StartGame, and nothing after that. For load generation that is enough and honestly so: a bot walks through walls, and the numbers it produces are still real, because the server does the same work either way.

Constructors ​

Constructor ​

new Bot(options): Bot

Defined in: client/src/bot/Bot.ts:55

Parameters ​

options ​

BotOptions

Returns ​

Bot

Properties ​

actions ​

readonly actions: Map<string, number>

Defined in: client/src/bot/Bot.ts:49

Counted per action name, merged into the fleet report.


failure ​

failure: string | null = null

Defined in: client/src/bot/Bot.ts:53


headYaw ​

headYaw: number = 0

Defined in: client/src/bot/Bot.ts:39


identity ​

identity: Identity

Defined in: client/src/bot/Bot.ts:41


loginLatencyMs ​

loginLatencyMs: number | null = null

Defined in: client/src/bot/Bot.ts:52

From the first packet sent to standing in the world, in milliseconds.


pitch ​

pitch: number = 0

Defined in: client/src/bot/Bot.ts:37


position ​

position: object

Defined in: client/src/bot/Bot.ts:36

x ​

x: number = 0

y ​

y: number = 0

z ​

z: number = 0


runtimeEntityId ​

runtimeEntityId: bigint = 0n

Defined in: client/src/bot/Bot.ts:40


yaw ​

yaw: number = 0

Defined in: client/src/bot/Bot.ts:38

Methods ​

connect() ​

connect(): Promise<void>

Defined in: client/src/bot/Bot.ts:75

Connects and logs in, recording how long it took. Throws with the reason if it fails.

Returns ​

Promise<void>


disconnect() ​

disconnect(reason?): void

Defined in: client/src/bot/Bot.ts:114

Parameters ​

reason? ​

string = 'bot finished'

Returns ​

void


getClient() ​

getClient(): Client

Defined in: client/src/bot/Bot.ts:66

Returns ​

Client


isConnected() ​

isConnected(): boolean

Defined in: client/src/bot/Bot.ts:70

Returns ​

boolean


start() ​

start(): void

Defined in: client/src/bot/Bot.ts:99

Starts ticking the behaviors. Idempotent.

Returns ​

void


stop() ​

stop(): void

Defined in: client/src/bot/Bot.ts:108

Returns ​

void