@block_factory/lib 0.0.1

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.
@@ -0,0 +1,18 @@
1
+ import esbuild from "esbuild";
2
+ /** @type { esbuild.BuildOptions } */
3
+ const options = {
4
+ format: "esm",
5
+ bundle: true,
6
+ target: [ "es2021" ],
7
+ platform: "neutral",
8
+ entryPoints: [ "index.ts" ],
9
+ outfile: "index.js",
10
+ sourcemap: false,
11
+ external: [
12
+ "@minecraft/server",
13
+ "@minecraft/server-ui",
14
+ ],
15
+ logLevel: "info"
16
+ };
17
+
18
+ esbuild.build(options);
package/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { MathUtils } from "./util/Math";
2
+ import { Signal } from "./util/Signal";
3
+ import { Vec2, Vec3 } from "./util/Vector";
4
+ import { RawText } from "./util/RawText";
5
+ import { Command } from "./util/Command";
6
+
7
+ export { MathUtils, Signal, Vec2, Vec3, RawText, Command }
8
+
9
+ export declare const BlockFactory: {
10
+ MathUtils: typeof MathUtils;
11
+ Signal: typeof Signal;
12
+ Vec2: typeof Vec2;
13
+ Vec3: typeof Vec3;
14
+ RawText: typeof RawText;
15
+ Command: typeof Command;
16
+ };
package/index.js ADDED
@@ -0,0 +1,526 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // util/Math.ts
6
+ var MathUtils;
7
+ ((MathUtils2) => {
8
+ function clamp(value, min, max) {
9
+ return Math.min(Math.max(value, min), max);
10
+ }
11
+ MathUtils2.clamp = clamp;
12
+ ;
13
+ function lerp(start, end, factor) {
14
+ return start + (end - start) * clamp(factor, 0, 1);
15
+ }
16
+ MathUtils2.lerp = lerp;
17
+ ;
18
+ function toRadians(degrees) {
19
+ return degrees * (Math.PI / 180);
20
+ }
21
+ MathUtils2.toRadians = toRadians;
22
+ ;
23
+ function toDegrees(radians) {
24
+ return radians * (180 / Math.PI);
25
+ }
26
+ MathUtils2.toDegrees = toDegrees;
27
+ ;
28
+ function fromRotation(rotation) {
29
+ const rotationH = toRadians(rotation.y * -1);
30
+ const z0 = Math.cos(rotationH);
31
+ const x0 = Math.sin(rotationH);
32
+ const rotationV = toRadians(rotation.x * -1);
33
+ const h = Math.cos(rotationV);
34
+ const v = Math.sin(rotationV);
35
+ return {
36
+ x: h * x0,
37
+ y: v,
38
+ z: h * z0
39
+ };
40
+ }
41
+ MathUtils2.fromRotation = fromRotation;
42
+ ;
43
+ function rotateOffset(offset, yawDegrees) {
44
+ const yaw = -yawDegrees * Math.PI / 180;
45
+ const cos = Math.cos(yaw);
46
+ const sin = Math.sin(yaw);
47
+ return {
48
+ x: offset.x * cos - offset.z * sin,
49
+ y: offset.y,
50
+ z: offset.x * sin + offset.z * cos
51
+ };
52
+ }
53
+ MathUtils2.rotateOffset = rotateOffset;
54
+ ;
55
+ function distance3D(pointA, pointB) {
56
+ const dx = pointB.x - pointA.x;
57
+ const dy = pointB.y - pointA.y;
58
+ const dz = pointB.z - pointA.z;
59
+ return Math.sqrt(dx * dx + dy * dy + dz * dz);
60
+ }
61
+ MathUtils2.distance3D = distance3D;
62
+ ;
63
+ function randomInt(min, max) {
64
+ return Math.floor(Math.random() * (max - min + 1)) + min;
65
+ }
66
+ MathUtils2.randomInt = randomInt;
67
+ ;
68
+ function randomFloat(min, max) {
69
+ return Math.random() * (max - min) + min;
70
+ }
71
+ MathUtils2.randomFloat = randomFloat;
72
+ ;
73
+ })(MathUtils || (MathUtils = {}));
74
+
75
+ // util/Signal.ts
76
+ var Signal = class {
77
+ constructor() {
78
+ __publicField(this, "listeners", /* @__PURE__ */ new Set());
79
+ }
80
+ /** Connect a listener */
81
+ connect(callback) {
82
+ this.listeners.add(callback);
83
+ }
84
+ /** Disconnect a listener */
85
+ disconnect(callback) {
86
+ if (callback) {
87
+ this.listeners.delete(callback);
88
+ return true;
89
+ } else {
90
+ this.listeners.clear();
91
+ return false;
92
+ }
93
+ }
94
+ /** Connect a listener that runs only once */
95
+ once(callback) {
96
+ const wrapper = (data) => {
97
+ this.disconnect(wrapper);
98
+ callback(data);
99
+ };
100
+ this.connect(wrapper);
101
+ }
102
+ /** Emit signal to all listeners */
103
+ emit(data) {
104
+ for (const cb of [...this.listeners]) {
105
+ cb(data);
106
+ }
107
+ }
108
+ };
109
+
110
+ // util/Vector.ts
111
+ var _Vec2 = class _Vec2 {
112
+ /**
113
+ * Creates a new Vec2.
114
+ * @param x X component
115
+ * @param y Y component
116
+ */
117
+ constructor(x, y) {
118
+ this.x = x;
119
+ this.y = y;
120
+ }
121
+ /**
122
+ * Adds a vector or scalar to a vector.
123
+ * @param a Base vector
124
+ * @param b Vector or scalar to add
125
+ */
126
+ static add(a, b) {
127
+ if (typeof b === "number") return new _Vec2(a.x + b, a.y + b);
128
+ else return new _Vec2(a.x + b.x, a.y + b.y);
129
+ }
130
+ /**
131
+ * Subtracts a vector or scalar from a vector.
132
+ * @param a Base vector
133
+ * @param b Vector or scalar to subtract
134
+ */
135
+ static subtract(a, b) {
136
+ if (typeof b === "number") return new _Vec2(a.x - b, a.y - b);
137
+ else return new _Vec2(a.x - b.x, a.y - b.y);
138
+ }
139
+ /**
140
+ * Multiplies a vector by another vector (component-wise) or scalar.
141
+ */
142
+ static multiply(a, b) {
143
+ if (typeof b === "number") return new _Vec2(a.x * b, a.y * b);
144
+ else return new _Vec2(a.x * b.x, a.y * b.y);
145
+ }
146
+ /**
147
+ * Divides a vector by another vector (component-wise) or scalar.
148
+ */
149
+ static divide(a, b) {
150
+ if (typeof b === "number") return new _Vec2(a.x / b, a.y / b);
151
+ else return new _Vec2(a.x / b.x, a.y / b.y);
152
+ }
153
+ /**
154
+ * Linearly interpolates between two vectors.
155
+ * @param t Interpolation factor (0–1)
156
+ */
157
+ static lerp(a, b, t) {
158
+ return new _Vec2(
159
+ a.x + (b.x - a.x) * t,
160
+ a.y + (b.y - a.y) * t
161
+ );
162
+ }
163
+ /**
164
+ * Clamps a vector between a minimum and maximum vector.
165
+ */
166
+ static clamp(v, min, max) {
167
+ return new _Vec2(
168
+ Math.min(Math.max(v.x, min.x), max.x),
169
+ Math.min(Math.max(v.y, min.y), max.y)
170
+ );
171
+ }
172
+ /**
173
+ * Dot product of two vectors.
174
+ */
175
+ static dot(a, b) {
176
+ return a.x * b.x + a.y * b.y;
177
+ }
178
+ /**
179
+ * Length (magnitude) of a vector.
180
+ */
181
+ static magnitude(a) {
182
+ return Math.sqrt(a.x * a.x + a.y * a.y);
183
+ }
184
+ /**
185
+ * Returns a normalized (unit length) vector.
186
+ * If magnitude is zero, returns (0, 0).
187
+ */
188
+ static normalize(a) {
189
+ const mag = _Vec2.magnitude(a);
190
+ return mag === 0 ? new _Vec2(0, 0) : new _Vec2(a.x / mag, a.y / mag);
191
+ }
192
+ /**
193
+ * Distance between two vectors.
194
+ */
195
+ static distance(a, b) {
196
+ return _Vec2.magnitude(_Vec2.subtract(a, b));
197
+ }
198
+ /**
199
+ * Returns the negated vector.
200
+ */
201
+ static negate(a) {
202
+ return new _Vec2(-a.x, -a.y);
203
+ }
204
+ /**
205
+ * Checks exact equality between two vectors.
206
+ */
207
+ static equals(a, b) {
208
+ return a.x === b.x && a.y === b.y;
209
+ }
210
+ /**
211
+ * Checks approximate equality between two vectors.
212
+ * @param epsilon Allowed difference threshold
213
+ */
214
+ static approxEquals(a, b, epsilon = 1e-4) {
215
+ return Math.abs(a.x - b.x) < epsilon && Math.abs(a.y - b.y) < epsilon;
216
+ }
217
+ /**
218
+ * Returns the angle (in radians) between two vectors.
219
+ * Returns 0 if either vector has zero length.
220
+ */
221
+ static angle(a, b) {
222
+ const magA = _Vec2.magnitude(a);
223
+ const magB = _Vec2.magnitude(b);
224
+ const denom = magA * magB;
225
+ if (denom === 0) return 0;
226
+ let c = _Vec2.dot(a, b) / denom;
227
+ c = Math.max(-1, Math.min(1, c));
228
+ return Math.acos(c);
229
+ }
230
+ /**
231
+ * Returns a perpendicular vector (-y, x).
232
+ */
233
+ static perpendicular(a) {
234
+ return new _Vec2(-a.y, a.x);
235
+ }
236
+ };
237
+ /** Constant zero vector (0, 0) */
238
+ __publicField(_Vec2, "ZERO", new _Vec2(0, 0));
239
+ /** Up direction (0, 1) */
240
+ __publicField(_Vec2, "UP", new _Vec2(0, 1));
241
+ /** Down direction (0, -1) */
242
+ __publicField(_Vec2, "DOWN", new _Vec2(0, -1));
243
+ /** Left direction (-1, 0) */
244
+ __publicField(_Vec2, "LEFT", new _Vec2(-1, 0));
245
+ /** Right direction (1, 0) */
246
+ __publicField(_Vec2, "RIGHT", new _Vec2(1, 0));
247
+ var Vec2 = _Vec2;
248
+ var _Vec3 = class _Vec3 {
249
+ /**
250
+ * Creates a new Vec3.
251
+ * @param x X component
252
+ * @param y Y component
253
+ * @param z Z component
254
+ */
255
+ constructor(x, y, z) {
256
+ this.x = x;
257
+ this.y = y;
258
+ this.z = z;
259
+ }
260
+ /**
261
+ * Adds a vector or scalar to a vector.
262
+ * @param a Base vector
263
+ * @param b Vector or scalar to add
264
+ */
265
+ static add(a, b) {
266
+ if (typeof b === "number") return new _Vec3(a.x + b, a.y + b, a.z + b);
267
+ else return new _Vec3(a.x + b.x, a.y + b.y, a.z + b.z);
268
+ }
269
+ /**
270
+ * Subtracts a vector or scalar from a vector.
271
+ * @param a Base vector
272
+ * @param b Vector or scalar to subtract
273
+ */
274
+ static subtract(a, b) {
275
+ if (typeof b === "number") return new _Vec3(a.x - b, a.y - b, a.z - b);
276
+ else return new _Vec3(a.x - b.x, a.y - b.y, a.z - b.z);
277
+ }
278
+ /**
279
+ * Multiplies a vector by another vector (component-wise) or scalar.
280
+ */
281
+ static multiply(a, b) {
282
+ if (typeof b === "number") return new _Vec3(a.x * b, a.y * b, a.z * b);
283
+ else return new _Vec3(a.x * b.x, a.y * b.y, a.z * b.z);
284
+ }
285
+ /**
286
+ * Divides a vector by another vector (component-wise) or scalar.
287
+ */
288
+ static divide(a, b) {
289
+ if (typeof b === "number") return new _Vec3(a.x / b, a.y / b, a.z / b);
290
+ else return new _Vec3(a.x / b.x, a.y / b.y, a.z / b.z);
291
+ }
292
+ /**
293
+ * Linearly interpolates between two vectors.
294
+ * @param t Interpolation factor (0–1)
295
+ */
296
+ static lerp(a, b, t) {
297
+ return new _Vec3(
298
+ a.x + (b.x - a.x) * t,
299
+ a.y + (b.y - a.y) * t,
300
+ a.z + (b.z - a.z) * t
301
+ );
302
+ }
303
+ /**
304
+ * Clamps a vector between a minimum and maximum vector.
305
+ */
306
+ static clamp(v, min, max) {
307
+ return new _Vec3(
308
+ Math.min(Math.max(v.x, min.x), max.x),
309
+ Math.min(Math.max(v.y, min.y), max.y),
310
+ Math.min(Math.max(v.z, min.z), max.z)
311
+ );
312
+ }
313
+ /**
314
+ * Dot product of two vectors.
315
+ */
316
+ static dot(a, b) {
317
+ return a.x * b.x + a.y * b.y + a.z * b.z;
318
+ }
319
+ /**
320
+ * Cross product of two vectors.
321
+ * Returns a vector perpendicular to both inputs.
322
+ */
323
+ static cross(a, b) {
324
+ return new _Vec3(
325
+ a.y * b.z - a.z * b.y,
326
+ a.z * b.x - a.x * b.z,
327
+ a.x * b.y - a.y * b.x
328
+ );
329
+ }
330
+ /**
331
+ * Length (magnitude) of a vector.
332
+ */
333
+ static magnitude(a) {
334
+ return Math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
335
+ }
336
+ /**
337
+ * Returns a normalized (unit length) vector.
338
+ * If magnitude is zero, returns (0, 0, 0).
339
+ */
340
+ static normalize(a) {
341
+ const mag = _Vec3.magnitude(a);
342
+ return mag === 0 ? new _Vec3(0, 0, 0) : new _Vec3(a.x / mag, a.y / mag, a.z / mag);
343
+ }
344
+ /**
345
+ * Distance between two vectors.
346
+ */
347
+ static distance(a, b) {
348
+ return _Vec3.magnitude(_Vec3.subtract(a, b));
349
+ }
350
+ /**
351
+ * Returns the negated vector.
352
+ */
353
+ static negate(a) {
354
+ return new _Vec3(-a.x, -a.y, -a.z);
355
+ }
356
+ /**
357
+ * Checks exact equality between two vectors.
358
+ */
359
+ static equals(a, b) {
360
+ return a.x === b.x && a.y === b.y && a.z === b.z;
361
+ }
362
+ /**
363
+ * Checks approximate equality between two vectors.
364
+ * @param epsilon Allowed difference threshold
365
+ */
366
+ static approxEquals(a, b, epsilon = 1e-4) {
367
+ return Math.abs(a.x - b.x) < epsilon && Math.abs(a.y - b.y) < epsilon && Math.abs(a.z - b.z) < epsilon;
368
+ }
369
+ /**
370
+ * Returns the angle (in radians) between two vectors.
371
+ * Returns 0 if either vector has zero length.
372
+ */
373
+ static angle(a, b) {
374
+ const magA = _Vec3.magnitude(a);
375
+ const magB = _Vec3.magnitude(b);
376
+ const denom = magA * magB;
377
+ if (denom === 0) return 0;
378
+ let c = _Vec3.dot(a, b) / denom;
379
+ c = Math.max(-1, Math.min(1, c));
380
+ return Math.acos(c);
381
+ }
382
+ /**
383
+ * Projects vector `a` onto vector `onto`.
384
+ * If `onto` has zero length, returns (0, 0, 0).
385
+ */
386
+ static project(a, onto) {
387
+ const denom = _Vec3.dot(onto, onto);
388
+ if (denom === 0) return new _Vec3(0, 0, 0);
389
+ const scale = _Vec3.dot(a, onto) / denom;
390
+ return _Vec3.multiply(onto, scale);
391
+ }
392
+ /**
393
+ * Converts spherical coordinates to cartesian coordinates.
394
+ * @param radius Distance from origin
395
+ * @param theta Azimuth angle (radians)
396
+ * @param phi Polar angle (radians)
397
+ */
398
+ static cartesian(radius, theta, phi) {
399
+ return new _Vec3(
400
+ radius * Math.sin(phi) * Math.cos(theta),
401
+ radius * Math.sin(phi) * Math.sin(theta),
402
+ radius * Math.cos(phi)
403
+ );
404
+ }
405
+ };
406
+ /** Constant zero vector (0, 0, 0) */
407
+ __publicField(_Vec3, "ZERO", new _Vec3(0, 0, 0));
408
+ /** Up direction (0, 1, 0) */
409
+ __publicField(_Vec3, "UP", new _Vec3(0, 1, 0));
410
+ /** Down direction (0, -1, 0) */
411
+ __publicField(_Vec3, "DOWN", new _Vec3(0, -1, 0));
412
+ /** Left direction (-1, 0, 0) */
413
+ __publicField(_Vec3, "LEFT", new _Vec3(-1, 0, 0));
414
+ /** Right direction (1, 0, 0) */
415
+ __publicField(_Vec3, "RIGHT", new _Vec3(1, 0, 0));
416
+ /** Forward direction (0, 0, 1) */
417
+ __publicField(_Vec3, "FORWARD", new _Vec3(0, 0, 1));
418
+ /** Backward direction (0, 0, -1) */
419
+ __publicField(_Vec3, "BACK", new _Vec3(0, 0, -1));
420
+ /** West direction (-1, 0, 0) */
421
+ __publicField(_Vec3, "WEST", new _Vec3(-1, 0, 0));
422
+ /** East direction (1, 0, 0) */
423
+ __publicField(_Vec3, "EAST", new _Vec3(1, 0, 0));
424
+ /** North direction (0, 0, 1) */
425
+ __publicField(_Vec3, "NORTH", new _Vec3(0, 0, 1));
426
+ /** South direction (0, 0, -1) */
427
+ __publicField(_Vec3, "SOUTH", new _Vec3(0, 0, -1));
428
+ var Vec3 = _Vec3;
429
+
430
+ // util/RawText.ts
431
+ var RawText;
432
+ ((RawText2) => {
433
+ RawText2.TEXT = (value) => ({
434
+ text: value
435
+ });
436
+ RawText2.TRANSLATE = (key, ...params) => ({
437
+ translate: key,
438
+ with: params.length ? params : void 0
439
+ });
440
+ RawText2.SCORE = (name, objective) => ({
441
+ score: {
442
+ name,
443
+ objective
444
+ }
445
+ });
446
+ RawText2.MESSAGE = (...rawText) => ({
447
+ rawtext: rawText
448
+ });
449
+ RawText2.FORMAT = {
450
+ DarkRed: (0, RawText2.TEXT)("\xA74"),
451
+ Red: (0, RawText2.TEXT)("\xA7c"),
452
+ Gold: (0, RawText2.TEXT)("\xA76"),
453
+ Yellow: (0, RawText2.TEXT)("\xA7e"),
454
+ Green: (0, RawText2.TEXT)("\xA72"),
455
+ Lime: (0, RawText2.TEXT)("\xA7a"),
456
+ Aqua: (0, RawText2.TEXT)("\xA7b"),
457
+ Cyan: (0, RawText2.TEXT)("\xA73"),
458
+ DarkBlue: (0, RawText2.TEXT)("\xA71"),
459
+ Blue: (0, RawText2.TEXT)("\xA79"),
460
+ Magenta: (0, RawText2.TEXT)("\xA7d"),
461
+ Purple: (0, RawText2.TEXT)("\xA75"),
462
+ White: (0, RawText2.TEXT)("\xA7f"),
463
+ Gray: (0, RawText2.TEXT)("\xA77"),
464
+ DarkGray: (0, RawText2.TEXT)("\xA78"),
465
+ Black: (0, RawText2.TEXT)("\xA70"),
466
+ Obfuscated: (0, RawText2.TEXT)("\xA7k"),
467
+ Bold: (0, RawText2.TEXT)("\xA7l"),
468
+ StrikeThrough: (0, RawText2.TEXT)("\xA7m"),
469
+ Italic: (0, RawText2.TEXT)("\xA7o"),
470
+ Reset: (0, RawText2.TEXT)("\xA7r"),
471
+ NewLine: (0, RawText2.TEXT)("\n")
472
+ };
473
+ })(RawText || (RawText = {}));
474
+
475
+ // util/Command.ts
476
+ import {
477
+ system
478
+ } from "@minecraft/server";
479
+ var Command;
480
+ ((Command2) => {
481
+ class ICustomCommand {
482
+ constructor() {
483
+ __publicField(this, "cheatsRequired");
484
+ __publicField(this, "mandatoryParameters");
485
+ __publicField(this, "optionalParameters");
486
+ }
487
+ }
488
+ Command2.ICustomCommand = ICustomCommand;
489
+ ;
490
+ Command2.customCommands = [];
491
+ function RegisterCustomCommand(customCommand) {
492
+ const instance = new customCommand();
493
+ Command2.customCommands.push(instance);
494
+ }
495
+ Command2.RegisterCustomCommand = RegisterCustomCommand;
496
+ ;
497
+ })(Command || (Command = {}));
498
+ system.beforeEvents.startup.subscribe(
499
+ (event) => {
500
+ const { customCommandRegistry } = event;
501
+ for (const command of Command.customCommands) {
502
+ customCommandRegistry.registerCommand(command, command.execute);
503
+ }
504
+ ;
505
+ }
506
+ );
507
+
508
+ // index.ts
509
+ var BlockFactory;
510
+ ((BlockFactory2) => {
511
+ MathUtils;
512
+ Signal;
513
+ Vec2;
514
+ Vec3;
515
+ RawText;
516
+ Command;
517
+ })(BlockFactory || (BlockFactory = {}));
518
+ export {
519
+ BlockFactory,
520
+ Command,
521
+ MathUtils,
522
+ RawText,
523
+ Signal,
524
+ Vec2,
525
+ Vec3
526
+ };
package/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { MathUtils } from "./util/Math";
2
+ import { Signal } from "./util/Signal";
3
+ import { Vec2, Vec3 } from "./util/Vector";
4
+ import { RawText } from "./util/RawText";
5
+ import { Command } from "./util/Command";
6
+
7
+ export { MathUtils, Signal, Vec2, Vec3, RawText, Command }
8
+
9
+ export namespace BlockFactory {
10
+ MathUtils;
11
+ Signal;
12
+ Vec2;
13
+ Vec3;
14
+ RawText;
15
+ Command;
16
+ }
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@block_factory/lib",
3
+ "version": "0.0.1",
4
+ "main": "index.js",
5
+ "types": "index.d.ts",
6
+ "description": "Typescript Library for Minecraft Bedrock Edition",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Block-Factory-Studio/bf-lib.git"
10
+ },
11
+ "author": "Block Factory x Donthedev",
12
+ "contributors": [
13
+ {
14
+ "name": "Donthedev",
15
+ "email": "donthedev@blockfactory.studio"
16
+ }
17
+ ],
18
+ "license": "MIT",
19
+ "bugs": {
20
+ "url": "https://github.com/Block-Factory-Studio/bf-lib/issues"
21
+ },
22
+ "homepage": "https://github.com/Block-Factory-Studio/bf-lib#readme",
23
+ "dependencies": {
24
+ "@minecraft/server": "^2.4.0",
25
+ "@minecraft/server-ui": "^2.0.0",
26
+ "all": "^0.0.0",
27
+ "esbuild": "^0.27.2"
28
+ },
29
+ "scripts": {
30
+ "build": "node esbuild.config.mjs"
31
+ }
32
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "outDir": ".",
6
+ "rootDir": ".",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "experimentalDecorators": true,
13
+ "moduleResolution": "node",
14
+ "lib": [
15
+ "ES2020",
16
+ "DOM"
17
+ ],
18
+ "allowJs": false
19
+ },
20
+ "include": [
21
+ "**/*.ts"
22
+ ],
23
+ "exclude": [
24
+ "node_modules",
25
+ "dist"
26
+ ]
27
+ }
@@ -0,0 +1,23 @@
1
+ import type {
2
+ CustomCommand,
3
+ CommandPermissionLevel,
4
+ CustomCommandParameter,
5
+ CustomCommandOrigin,
6
+ CustomCommandResult
7
+ } from "@minecraft/server";
8
+
9
+ export declare namespace Command {
10
+ export abstract class ICustomCommand implements CustomCommand {
11
+ public abstract description: string;
12
+ public abstract name: string;
13
+ public abstract permissionLevel: CommandPermissionLevel;
14
+ public cheatsRequired?: boolean;
15
+ public mandatoryParameters?: CustomCommandParameter[];
16
+ public optionalParameters?: CustomCommandParameter[];
17
+ public abstract execute(origin: CustomCommandOrigin, ...args: any[]): CustomCommandResult | undefined;
18
+ }
19
+
20
+ export const customCommands: ICustomCommand[];
21
+
22
+ export function RegisterCustomCommand<T extends { new(): ICustomCommand }>(customCommand: T): void;
23
+ }