@sectersion/rockbot 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +345 -0
  2. package/dist/auth/env.d.ts +6 -0
  3. package/dist/auth/env.d.ts.map +1 -0
  4. package/dist/auth/env.js +17 -0
  5. package/dist/auth/env.js.map +1 -0
  6. package/dist/auth/file.d.ts +9 -0
  7. package/dist/auth/file.d.ts.map +1 -0
  8. package/dist/auth/file.js +67 -0
  9. package/dist/auth/file.js.map +1 -0
  10. package/dist/auth/provider.d.ts +3 -0
  11. package/dist/auth/provider.d.ts.map +1 -0
  12. package/dist/auth/provider.js +3 -0
  13. package/dist/auth/provider.js.map +1 -0
  14. package/dist/block.d.ts +11 -0
  15. package/dist/block.d.ts.map +1 -0
  16. package/dist/block.js +21 -0
  17. package/dist/block.js.map +1 -0
  18. package/dist/bot.d.ts +37 -0
  19. package/dist/bot.d.ts.map +1 -0
  20. package/dist/bot.js +251 -0
  21. package/dist/bot.js.map +1 -0
  22. package/dist/entity.d.ts +19 -0
  23. package/dist/entity.d.ts.map +1 -0
  24. package/dist/entity.js +32 -0
  25. package/dist/entity.js.map +1 -0
  26. package/dist/fleet.d.ts +21 -0
  27. package/dist/fleet.d.ts.map +1 -0
  28. package/dist/fleet.js +110 -0
  29. package/dist/fleet.js.map +1 -0
  30. package/dist/group.d.ts +12 -0
  31. package/dist/group.d.ts.map +1 -0
  32. package/dist/group.js +37 -0
  33. package/dist/group.js.map +1 -0
  34. package/dist/index.d.ts +13 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +26 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/plugins/loader.d.ts +4 -0
  39. package/dist/plugins/loader.d.ts.map +1 -0
  40. package/dist/plugins/loader.js +15 -0
  41. package/dist/plugins/loader.js.map +1 -0
  42. package/dist/tick.d.ts +33 -0
  43. package/dist/tick.d.ts.map +1 -0
  44. package/dist/tick.js +126 -0
  45. package/dist/tick.js.map +1 -0
  46. package/dist/types.d.ts +45 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +3 -0
  49. package/dist/types.js.map +1 -0
  50. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,345 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/rockbot-Multi--Bot%20Orchestration%20for%20Minecraft%20Bedrock-4ade80?style=for-the-badge&labelColor=1a1a2e">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <img src="https://img.shields.io/badge/status-alpha-orangered">
7
+ <img src="https://img.shields.io/badge/Node.js-18%2B-339933?logo=nodedotjs&logoColor=white">
8
+ <img src="https://img.shields.io/badge/TypeScript-5.4-3178C6?logo=typescript&logoColor=white">
9
+ <img src="https://img.shields.io/badge/license-MIT-yellow">
10
+ <img src="https://img.shields.io/github/last-commit/sectersion/rockbot">
11
+ <img src="https://img.shields.io/npm/v/@sectersion/rockbot?label=npm">
12
+ </p>
13
+
14
+ <p align="center">
15
+ <b>A high-level API over <code>bedrock-protocol</code>, styled after Mineflayer — designed for one bot or a hundred.</b>
16
+ </p>
17
+
18
+ ---
19
+
20
+ ## Table of Contents
21
+ - [About](#-about)
22
+ - [Quickstart](#-quickstart)
23
+ - [Installation](#-installation)
24
+ - [API Reference](#-api-reference)
25
+ - [createBot](#createbotoptions)
26
+ - [Bot](#bot)
27
+ - [createFleet](#createfleetoptions)
28
+ - [Fleet](#fleet)
29
+ - [Group](#group)
30
+ - [Auth](#-auth)
31
+ - [Plugins](#-plugins)
32
+ - [Architecture](#-architecture)
33
+ - [Development](#-development)
34
+ - [License](#-license)
35
+
36
+ ---
37
+
38
+ ## 🚀 About
39
+
40
+ **rockbot** turns `bedrock-protocol`'s raw packet stream into a Mineflayer-style API — events, entity tracking, movement controls, chat — and then layers a Fleet primitive on top so you can spawn, manage, and coordinate N bots without managing N arrays of EventEmitters.
41
+
42
+ - **Mineflayer-style per-bot API** — `bot.chat()`, `bot.blockAt()`, `bot.pathfinder.goto()`, `bot.setControlState()`, events, plugins
43
+ - **First-class fleet management** — `createFleet()` with auth provider integration, named bots, event aggregation, sub-team groups
44
+ - **Automatic tick loop** — `PlayerAuthInput` at 20hz keeps every bot alive regardless of what user code is doing
45
+ - **Entity tracking in real time** — position, rotation, metadata for every player in view distance
46
+ - **Graceful shutdown** — SIGINT/SIGTERM handled, clean disconnect on exit
47
+ - **Plugin system** — Mineflayer-compatible plugin injection
48
+
49
+ ---
50
+
51
+ ## ⚡ Quickstart
52
+
53
+ ### Single bot
54
+
55
+ ```ts
56
+ import { createBot } from 'rockbot'
57
+
58
+ const bot = createBot({
59
+ host: 'play.lbsg.net',
60
+ username: 'RockBot',
61
+ })
62
+
63
+ bot.on('spawn', () => {
64
+ console.log(`${bot.username} spawned at ${bot.position}`)
65
+ bot.chat('Hello from rockbot!')
66
+ })
67
+
68
+ bot.on('chat', (username, message) => {
69
+ console.log(`<${username}> ${message}`)
70
+ })
71
+ ```
72
+
73
+ ### Fleet of bots
74
+
75
+ ```ts
76
+ import { createFleet } from 'rockbot'
77
+
78
+ const fleet = createFleet({
79
+ defaults: { host: 'play.lbsg.net' },
80
+ auth: { provider: 'file', source: './accounts.csv' },
81
+ })
82
+
83
+ fleet.on('spawn', (bot) => console.log(`${bot.username} joined`))
84
+ fleet.on('chat', (bot, user, msg) => console.log(`[${bot.name}] <${user}> ${msg}`))
85
+
86
+ await fleet.spawn(5)
87
+ fleet.broadcast('We come in peace.')
88
+ ```
89
+
90
+ ---
91
+
92
+ ## 📦 Installation
93
+
94
+ ```bash
95
+ npm install @sectersion/rockbot
96
+ ```
97
+
98
+ Requires **Node.js 18+**.
99
+
100
+ ---
101
+
102
+ ## 📖 API Reference
103
+
104
+ ### createBot(options)
105
+
106
+ | Option | Type | Default | Description |
107
+ |--------|------|---------|-------------|
108
+ | `host` | `string` | `'127.0.0.1'` | Server address |
109
+ | `port` | `number` | `19132` | Server port |
110
+ | `username` | `string` | **required** | Bot name |
111
+ | `offline` | `boolean` | `false` | Skip Xbox Live auth |
112
+ | `version` | `string` | auto-detect | Protocol version |
113
+ | `viewDistance` | `number` | `8` | Chunk radius |
114
+ | `connectTimeout` | `number` | `9000` | Connection timeout (ms) |
115
+ | `plugins` | `PluginDeclaration[]` | — | Mineflayer-style plugins |
116
+
117
+ ### Bot
118
+
119
+ ```ts
120
+ const bot = createBot({ host: 'localhost', username: 'Bot1', offline: true })
121
+ ```
122
+
123
+ | Method | Returns | Description |
124
+ |--------|---------|-------------|
125
+ | `bot.chat(msg)` | `void` | Send chat message |
126
+ | `bot.whisper(user, msg)` | `void` | Send private message |
127
+ | `bot.look(yaw, pitch)` | `void` | Set rotation |
128
+ | `bot.lookAt(point)` | `void` | Look at a Vec3 position |
129
+ | `bot.setControlState(control, bool)` | `void` | Set movement flag |
130
+ | `bot.clearControlStates()` | `void` | Reset all movement flags |
131
+ | `bot.quit(reason?)` | `void` | Disconnect cleanly |
132
+ | `bot.end(reason?)` | `void` | Alias for quit |
133
+
134
+ Movement controls: `forward`, `back`, `left`, `right`, `jump`, `sneak`, `sprint`
135
+
136
+ | Property | Type | Description |
137
+ |----------|------|-------------|
138
+ | `bot.username` | `string` | Current username |
139
+ | `bot.entity` | `Entity` | Self entity (id, position, rotation) |
140
+ | `bot.entities` | `Map<number, Entity>` | All tracked entities |
141
+ | `bot.position` | `Vec3` | Current position |
142
+ | `bot.rotation` | `{ yaw, pitch }` | Current rotation |
143
+ | `bot.health` | `number` | HP (0–20) |
144
+ | `bot.food` | `number` | Hunger (0–20) |
145
+ | `bot.game` | `object` | `{ dimension, difficulty, gameMode }` |
146
+
147
+ | Event | Arguments | Description |
148
+ |-------|-----------|-------------|
149
+ | `spawn` | — | Bot fully joined the server |
150
+ | `login` | — | Authenticated and connected |
151
+ | `chat` | `(username, message)` | Chat message received |
152
+ | `whisper` | `(username, message)` | Private message |
153
+ | `message` | `(text)` | System message |
154
+ | `health` | — | HP or food changed |
155
+ | `entitySpawn` | `(entity)` | Entity entered view distance |
156
+ | `entityGone` | `(entity)` | Entity left view distance |
157
+ | `kicked` | `(reason)` | Bot was kicked |
158
+ | `error` | `(error)` | Error occurred |
159
+ | `end` | — | Connection closed |
160
+ | `respawn` | — | Bot respawned after death |
161
+ | `game` | — | Game data received |
162
+
163
+ ---
164
+
165
+ ### createFleet(options)
166
+
167
+ | Option | Type | Description |
168
+ |--------|------|-------------|
169
+ | `defaults` | `Partial<BotOptions>` | Default options for every bot |
170
+ | `auth` | `AuthConfig` | Credential provider |
171
+ | `plugins` | `PluginDeclaration[]` | Fleet-level plugins |
172
+
173
+ ### Fleet
174
+
175
+ ```ts
176
+ const fleet = createFleet({
177
+ defaults: { host: 'play.lbsg.net' },
178
+ auth: { provider: 'file', source: './accounts.csv' },
179
+ })
180
+ ```
181
+
182
+ | Method | Returns | Description |
183
+ |--------|---------|-------------|
184
+ | `fleet.spawn(n)` | `Promise<Bot[]>` | Spawn N bots |
185
+ | `fleet.spawn(opts)` | `Promise<Bot>` | Spawn one with per-bot options |
186
+ | `fleet.despawn(name)` | — | Disconnect and remove a bot |
187
+ | `fleet.despawnAll()` | — | Disconnect all bots |
188
+ | `fleet.bot(name)` | `Bot \| undefined` | Get a bot by name |
189
+ | `fleet.broadcast(msg)` | — | Chat from every bot |
190
+ | `fleet.group(names)` | `Group` | Create a sub-team |
191
+
192
+ | Event | Arguments | Description |
193
+ |-------|-----------|-------------|
194
+ | `spawn` | `(bot)` | A bot joined |
195
+ | `chat` | `(bot, username, message)` | Any bot heard chat |
196
+ | `kicked` | `(bot, reason)` | A bot was kicked |
197
+ | `end` | `(bot)` | A bot disconnected |
198
+ | `error` | `(bot, error)` | A bot error |
199
+
200
+ ### Group
201
+
202
+ ```ts
203
+ const miners = fleet.group(['miner-1', 'miner-2'])
204
+ miners.broadcast('Starting dig job!')
205
+ const results = await miners.call('chat', 'ready')
206
+ ```
207
+
208
+ | Method | Description |
209
+ |--------|-------------|
210
+ | `group.add(bot)` | Add a bot |
211
+ | `group.remove(bot)` | Remove a bot |
212
+ | `group.broadcast(msg)` | Chat from all group members |
213
+ | `group.call(method, ...args)` | Call a method on all bots in parallel |
214
+ | `group.on(event, fn)` | Forward events from group bots |
215
+
216
+ ---
217
+
218
+ ## 🔐 Auth
219
+
220
+ ### File provider (CSV)
221
+
222
+ ```csv
223
+ username,password,email
224
+ BotOne,pass123,bot1@example.com
225
+ BotTwo,pass456,bot2@example.com
226
+ ```
227
+
228
+ ```ts
229
+ createFleet({
230
+ auth: { provider: 'file', source: './accounts.csv' },
231
+ })
232
+ ```
233
+
234
+ ### Environment provider
235
+
236
+ ```ts
237
+ createFleet({
238
+ auth: { provider: 'env' },
239
+ })
240
+ // Reads: BOT_USERNAME, BOT_PASSWORD, BOT_EMAIL
241
+ ```
242
+
243
+ ### Custom provider
244
+
245
+ ```ts
246
+ import type { AuthProvider, Account } from 'rockbot'
247
+
248
+ class MyAuth implements AuthProvider {
249
+ async acquire(): Promise<Account> {
250
+ return { username: 'Bot', token: '...' }
251
+ }
252
+ async release(account: Account, reason?: string): Promise<void> {}
253
+ }
254
+
255
+ createFleet({
256
+ auth: { provider: new MyAuth() },
257
+ })
258
+ ```
259
+
260
+ ---
261
+
262
+ ## 🔌 Plugins
263
+
264
+ Plugins inject functionality into a bot at construction time — same pattern as Mineflayer.
265
+
266
+ ```ts
267
+ function autoEat(bot: Bot, options?: any) {
268
+ bot.on('health', () => {
269
+ if (bot.food < 6) bot.chat('/eat')
270
+ })
271
+ }
272
+
273
+ const bot = createBot({
274
+ host: 'localhost',
275
+ username: 'Bot',
276
+ offline: true,
277
+ plugins: [[autoEat, { threshold: 10 }]],
278
+ })
279
+ ```
280
+
281
+ Fleet-level plugins are automatically applied to every spawned bot.
282
+
283
+ ---
284
+
285
+ ## 🏗 Architecture
286
+
287
+ ```
288
+ ┌────────────────────────────────────────────┐
289
+ │ rockbot │
290
+ │ │
291
+ │ Bot Mineflayer-style per-bot API │
292
+ │ ├── events spawn, chat, health, ... │
293
+ │ ├── tick PlayerAuthInput at 20hz │
294
+ │ └── plugins Plugin injection │
295
+ │ │
296
+ │ Fleet Multi-bot manager │
297
+ │ ├── spawn() Auth provider integration │
298
+ │ ├── group() Sub-team coordination │
299
+ │ └── events Aggregated from all bots │
300
+ │ │
301
+ │ AuthProvider Pluggable credential source │
302
+ └────────────────┬───────────────────────────┘
303
+
304
+ ┌────────────────▼───────────────────────────┐
305
+ │ bedrock-protocol │
306
+ │ (RakNet, Xbox Live, packet I/O) │
307
+ └────────────────────────────────────────────┘
308
+ ```
309
+
310
+ ### Dependencies
311
+
312
+ | Package | Role |
313
+ |---------|------|
314
+ | [`bedrock-protocol`](https://github.com/PrismarineJS/bedrock-protocol) | RakNet networking, auth, packet I/O |
315
+ | [`vec3`](https://github.com/PrismarineJS/node-vec3) | 3D vector math |
316
+ | [`minecraft-data`](https://github.com/PrismarineJS/minecraft-data) | Block/item ID registry |
317
+
318
+ ---
319
+
320
+ ## 🛠 Development
321
+
322
+ ```bash
323
+ git clone https://github.com/sectersion/rockbot
324
+ cd rockbot
325
+ npm install
326
+ npm run build
327
+ ```
328
+
329
+ ### Test on a live server
330
+
331
+ ```bash
332
+ npx tsx test/lifeboat.ts
333
+ ```
334
+
335
+ The first run triggers a Microsoft device-code login flow — visit the printed URL, enter the code, and the bot connects.
336
+
337
+ ---
338
+
339
+ ## 📄 License
340
+
341
+ MIT
342
+
343
+ <p align="center">
344
+ <sub>Built on the <a href="https://github.com/PrismarineJS">PrismarineJS</a> ecosystem. Inspired by <a href="https://github.com/PrismarineJS/mineflayer">Mineflayer</a>.</sub>
345
+ </p>
@@ -0,0 +1,6 @@
1
+ import { AuthProvider, Account } from '../types';
2
+ export declare class EnvAuthProvider implements AuthProvider {
3
+ acquire(): Promise<Account>;
4
+ release(_account: Account, _reason?: string): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/auth/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEhD,qBAAa,eAAgB,YAAW,YAAY;IAC5C,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAQ3B,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlE"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvAuthProvider = void 0;
4
+ class EnvAuthProvider {
5
+ async acquire() {
6
+ return {
7
+ username: process.env.BOT_USERNAME || 'Bot',
8
+ password: process.env.BOT_PASSWORD,
9
+ email: process.env.BOT_EMAIL,
10
+ };
11
+ }
12
+ async release(_account, _reason) {
13
+ // no-op for env provider
14
+ }
15
+ }
16
+ exports.EnvAuthProvider = EnvAuthProvider;
17
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/auth/env.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAe;IAC1B,KAAK,CAAC,OAAO;QACX,OAAO;YACL,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,KAAK;YAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;YAClC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;SAC7B,CAAA;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAiB,EAAE,OAAgB;QAC/C,yBAAyB;IAC3B,CAAC;CACF;AAZD,0CAYC"}
@@ -0,0 +1,9 @@
1
+ import { AuthProvider, Account } from '../types';
2
+ export declare class FileAuthProvider implements AuthProvider {
3
+ private accounts;
4
+ private index;
5
+ constructor(path: string);
6
+ acquire(): Promise<Account>;
7
+ release(_account: Account, _reason?: string): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/auth/file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEhD,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,KAAK,CAAQ;gBAET,IAAI,EAAE,MAAM;IAclB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAS3B,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlE"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.FileAuthProvider = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ class FileAuthProvider {
39
+ accounts;
40
+ index;
41
+ constructor(path) {
42
+ const raw = fs.readFileSync(path, 'utf-8');
43
+ const lines = raw.trim().split('\n');
44
+ this.accounts = lines.map(line => {
45
+ const parts = line.split(',').map(s => s.trim());
46
+ return {
47
+ username: parts[0],
48
+ password: parts[1],
49
+ email: parts[2],
50
+ };
51
+ });
52
+ this.index = 0;
53
+ }
54
+ async acquire() {
55
+ if (this.accounts.length === 0) {
56
+ throw new Error('No accounts available');
57
+ }
58
+ const account = this.accounts[this.index % this.accounts.length];
59
+ this.index++;
60
+ return account;
61
+ }
62
+ async release(_account, _reason) {
63
+ // no-op for file provider
64
+ }
65
+ }
66
+ exports.FileAuthProvider = FileAuthProvider;
67
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/auth/file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AAGxB,MAAa,gBAAgB;IACnB,QAAQ,CAAW;IACnB,KAAK,CAAQ;IAErB,YAAY,IAAY;QACtB,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACpC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;YAChD,OAAO;gBACL,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;gBAClB,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;gBAClB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aAChB,CAAA;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;QAC1C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAChE,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAiB,EAAE,OAAgB;QAC/C,0BAA0B;IAC5B,CAAC;CACF;AA9BD,4CA8BC"}
@@ -0,0 +1,3 @@
1
+ import { AuthProvider, Account } from '../types';
2
+ export { AuthProvider, Account };
3
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/auth/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/auth/provider.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { Vec3 } from 'vec3';
2
+ export declare class Block {
3
+ name: string;
4
+ position: Vec3;
5
+ id: number;
6
+ hardness: number;
7
+ displayName: string;
8
+ boundingBox: 'block' | 'empty' | 'liquid';
9
+ constructor(name: string, position: Vec3, id: number, hardness?: number, displayName?: string);
10
+ }
11
+ //# sourceMappingURL=block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../src/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,qBAAa,KAAK;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,IAAI,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;gBAE7B,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,SAAI,EAAE,WAAW,SAAK;CAQrF"}
package/dist/block.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Block = void 0;
4
+ class Block {
5
+ name;
6
+ position;
7
+ id;
8
+ hardness;
9
+ displayName;
10
+ boundingBox;
11
+ constructor(name, position, id, hardness = 0, displayName = '') {
12
+ this.name = name;
13
+ this.position = position;
14
+ this.id = id;
15
+ this.hardness = hardness;
16
+ this.displayName = displayName || name;
17
+ this.boundingBox = 'block';
18
+ }
19
+ }
20
+ exports.Block = Block;
21
+ //# sourceMappingURL=block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.js","sourceRoot":"","sources":["../src/block.ts"],"names":[],"mappings":";;;AAEA,MAAa,KAAK;IAChB,IAAI,CAAQ;IACZ,QAAQ,CAAM;IACd,EAAE,CAAQ;IACV,QAAQ,CAAQ;IAChB,WAAW,CAAQ;IACnB,WAAW,CAA8B;IAEzC,YAAY,IAAY,EAAE,QAAc,EAAE,EAAU,EAAE,QAAQ,GAAG,CAAC,EAAE,WAAW,GAAG,EAAE;QAClF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,IAAI,CAAA;QACtC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAA;IAC5B,CAAC;CACF;AAhBD,sBAgBC"}
package/dist/bot.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { EventEmitter } from 'events';
2
+ import { Vec3 } from 'vec3';
3
+ import { Entity } from './entity';
4
+ import { TickLoop } from './tick';
5
+ import { BotOptions, ControlState } from './types';
6
+ export declare class Bot extends EventEmitter {
7
+ username: string;
8
+ entity: Entity;
9
+ entities: Map<number, Entity>;
10
+ health: number;
11
+ food: number;
12
+ game: {
13
+ dimension: string;
14
+ difficulty: number;
15
+ gameMode: number;
16
+ };
17
+ _client: any;
18
+ _controls: ControlState;
19
+ _tick: TickLoop;
20
+ _destroyed: boolean;
21
+ _signalHandler: () => void;
22
+ constructor(options: BotOptions);
23
+ get position(): Vec3;
24
+ get rotation(): {
25
+ yaw: number;
26
+ pitch: number;
27
+ };
28
+ chat(msg: string): void;
29
+ whisper(username: string, msg: string): void;
30
+ look(yaw: number, pitch: number): void;
31
+ lookAt(point: Vec3): void;
32
+ setControlState(control: keyof ControlState, state: boolean): void;
33
+ clearControlStates(): void;
34
+ quit(reason?: string): void;
35
+ end(reason?: string): void;
36
+ }
37
+ //# sourceMappingURL=bot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../src/bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAalD,qBAAa,GAAI,SAAQ,YAAY;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAEjE,OAAO,EAAE,GAAG,CAAA;IACZ,SAAS,EAAE,YAAY,CAAA;IACvB,KAAK,EAAE,QAAQ,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,cAAc,EAAE,MAAM,IAAI,CAAA;gBAEd,OAAO,EAAE,UAAU;IA+I/B,IAAI,QAAQ,IAAI,IAAI,CAEnB;IAED,IAAI,QAAQ,IAAI;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAE7C;IAED,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAWvB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAW5C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKtC,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI;IASzB,eAAe,CAAC,OAAO,EAAE,MAAM,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAMlE,kBAAkB,IAAI,IAAI;IAI1B,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAM3B,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;CAG3B"}