@nxg-org/mineflayer-util-plugin 1.7.11 → 1.8.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.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/static/index.d.ts +1 -0
- package/lib/static/index.js +1 -0
- package/lib/static/tasks.d.ts +9 -0
- package/lib/static/tasks.js +37 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export default function inject(bot: Bot): void;
|
|
|
19
19
|
export { AABB } from "./calcs/aabb";
|
|
20
20
|
export { InterceptFunctions } from "./calcs/intercept";
|
|
21
21
|
export { RaycastIterator, BlockFace } from "./calcs/iterators";
|
|
22
|
-
export { AABBUtils, MathUtils } from "./static";
|
|
22
|
+
export { AABBUtils, MathUtils, Task } from "./static";
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MathUtils = exports.AABBUtils = exports.BlockFace = exports.RaycastIterator = exports.InterceptFunctions = exports.AABB = void 0;
|
|
3
|
+
exports.Task = exports.MathUtils = exports.AABBUtils = exports.BlockFace = exports.RaycastIterator = exports.InterceptFunctions = exports.AABB = void 0;
|
|
4
4
|
const utilFunctions_1 = require("./utilFunctions");
|
|
5
5
|
function inject(bot) {
|
|
6
6
|
bot.util = new utilFunctions_1.UtilFunctions(bot);
|
|
@@ -16,3 +16,4 @@ Object.defineProperty(exports, "BlockFace", { enumerable: true, get: function ()
|
|
|
16
16
|
var static_1 = require("./static");
|
|
17
17
|
Object.defineProperty(exports, "AABBUtils", { enumerable: true, get: function () { return static_1.AABBUtils; } });
|
|
18
18
|
Object.defineProperty(exports, "MathUtils", { enumerable: true, get: function () { return static_1.MathUtils; } });
|
|
19
|
+
Object.defineProperty(exports, "Task", { enumerable: true, get: function () { return static_1.Task; } });
|
package/lib/static/index.d.ts
CHANGED
package/lib/static/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./aabbUtil"), exports);
|
|
18
18
|
__exportStar(require("./mathUtil"), exports);
|
|
19
|
+
__exportStar(require("./tasks"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class Task<Finish = void, Cancel = void> {
|
|
2
|
+
done: boolean;
|
|
3
|
+
promise: Promise<any>;
|
|
4
|
+
cancel: (error: Cancel) => Cancel;
|
|
5
|
+
finish: (result: Finish) => Finish;
|
|
6
|
+
constructor();
|
|
7
|
+
static createTask<Finish = void, Cancel = void>(): Task<Finish, Cancel>;
|
|
8
|
+
static createDoneTask(): Task<any, any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Task = void 0;
|
|
4
|
+
// stolen task from mineflayer, just strongly typed now.
|
|
5
|
+
class Task {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.done = false;
|
|
8
|
+
this.promise = new Promise((resolve, reject) => {
|
|
9
|
+
this.cancel = (err) => {
|
|
10
|
+
if (!this.done) {
|
|
11
|
+
this.done = true;
|
|
12
|
+
reject(err);
|
|
13
|
+
}
|
|
14
|
+
throw err;
|
|
15
|
+
};
|
|
16
|
+
this.finish = (result) => {
|
|
17
|
+
if (!this.done) {
|
|
18
|
+
this.done = true;
|
|
19
|
+
resolve(result);
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
static createTask() {
|
|
26
|
+
return new Task();
|
|
27
|
+
}
|
|
28
|
+
static createDoneTask() {
|
|
29
|
+
return {
|
|
30
|
+
done: true,
|
|
31
|
+
promise: Promise.resolve(),
|
|
32
|
+
cancel: () => { },
|
|
33
|
+
finish: () => { }
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Task = Task;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxg-org/mineflayer-util-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "mineflayer utils for NextGEN mineflayer plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mineflayer",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^17.0.4",
|
|
25
|
-
"mineflayer": "^4.
|
|
25
|
+
"mineflayer": "^4.8.1",
|
|
26
26
|
"typescript": "^4.5.2",
|
|
27
27
|
"vec3": "^0.1.7"
|
|
28
28
|
}
|