@nxg-org/mineflayer-util-plugin 1.8.3 → 1.9.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/.vscode/settings.json +2 -2
- package/LICENSE +674 -674
- package/lib/calcs/aabb.d.ts +81 -81
- package/lib/calcs/aabb.js +330 -330
- package/lib/calcs/intercept.d.ts +20 -20
- package/lib/calcs/intercept.js +50 -50
- package/lib/calcs/iterators.d.ts +45 -45
- package/lib/calcs/iterators.js +114 -114
- package/lib/entityFunctions.d.ts +43 -43
- package/lib/entityFunctions.js +80 -80
- package/lib/filterFunctions.d.ts +22 -22
- package/lib/filterFunctions.js +44 -44
- package/lib/index.d.ts +22 -22
- package/lib/index.js +19 -19
- package/lib/inventoryFunctions.d.ts +38 -37
- package/lib/inventoryFunctions.js +141 -134
- package/lib/movementFunctions.d.ts +20 -10
- package/lib/movementFunctions.js +135 -49
- package/lib/predictiveFunctions.d.ts +24 -24
- package/lib/predictiveFunctions.js +188 -188
- package/lib/rayTracingFunctions.d.ts +21 -21
- package/lib/rayTracingFunctions.js +85 -85
- package/lib/static/aabbUtil.d.ts +24 -24
- package/lib/static/aabbUtil.js +41 -41
- package/lib/static/index.d.ts +3 -3
- package/lib/static/index.js +19 -19
- package/lib/static/mathUtil.d.ts +29 -29
- package/lib/static/mathUtil.js +70 -70
- package/lib/static/tasks.d.ts +9 -9
- package/lib/static/tasks.js +37 -37
- package/lib/utilFunctions.d.ts +26 -26
- package/lib/utilFunctions.js +32 -32
- package/lib/worldRelated/predictiveWorld.d.ts +42 -42
- package/lib/worldRelated/predictiveWorld.js +111 -111
- package/package.json +30 -28
package/lib/entityFunctions.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EntityFunctions = void 0;
|
|
4
|
-
const static_1 = require("./static");
|
|
5
|
-
class EntityFunctions {
|
|
6
|
-
constructor(bot) {
|
|
7
|
-
this.bot = bot;
|
|
8
|
-
this.healthSlot = 7;
|
|
9
|
-
this.healthSlot = Number(this.bot.version.split(".")[1]) <= 16 ? 7 : 9;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* TODO: Version specific right now. Generalize. Unknown method.
|
|
13
|
-
*
|
|
14
|
-
* Checks if main hand is activated.
|
|
15
|
-
* @returns boolean
|
|
16
|
-
*/
|
|
17
|
-
isMainHandActive(entity) {
|
|
18
|
-
return (entity !== null && entity !== void 0 ? entity : this.bot.entity).metadata[6] === 2; //as any & (1 | 0)) === (1 | 0);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* TODO: Version specific right now. Generalize. Unknown method.
|
|
22
|
-
*
|
|
23
|
-
* Checks if offhand is activated.
|
|
24
|
-
* @returns boolean
|
|
25
|
-
*/
|
|
26
|
-
isOffHandActive(entity) {
|
|
27
|
-
return (entity !== null && entity !== void 0 ? entity : this.bot.entity).metadata[6] === 3; //& (1 | 2)) === (1 | 2);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* TODO: Version specific right now. Generalize. Unknown method.
|
|
31
|
-
* @param metadata metadata from Prismarine-Entity Entity.
|
|
32
|
-
* @returns number
|
|
33
|
-
*/
|
|
34
|
-
getHealth(entity) {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
entity !== null && entity !== void 0 ? entity : (entity = this.bot.entity);
|
|
37
|
-
const metadata = entity.metadata;
|
|
38
|
-
let health = Number(metadata[this.healthSlot]);
|
|
39
|
-
if (!health || health === 0)
|
|
40
|
-
health = entity === this.bot.entity ? (_a = this.bot.entity.health) !== null && _a !== void 0 ? _a : 0 : 0;
|
|
41
|
-
return health + ((_b = Number(metadata[this.healthSlot + 4])) !== null && _b !== void 0 ? _b : 0);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param metadata Must be FULL metadata object.
|
|
46
|
-
* @returns number
|
|
47
|
-
*/
|
|
48
|
-
getHealthFromMetadata(metadata) {
|
|
49
|
-
var _a;
|
|
50
|
-
return (_a = Number(metadata[this.healthSlot]) + Number(metadata[this.healthSlot + 4])) !== null && _a !== void 0 ? _a : undefined;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* TODO: Version specific right now. Generalize. Unknown method.
|
|
54
|
-
* @param metadata metadata from Prismarine-Entity Entity.
|
|
55
|
-
* @returns
|
|
56
|
-
*/
|
|
57
|
-
getHealthChange(packetMetadata, entity) {
|
|
58
|
-
const oldHealth = this.getHealthFromMetadata(entity.metadata);
|
|
59
|
-
const newHealth = this.getHealthFromMetadata(this.parseMetadata(packetMetadata, entity.metadata));
|
|
60
|
-
return newHealth - oldHealth;
|
|
61
|
-
}
|
|
62
|
-
entityDistance(entity) {
|
|
63
|
-
return this.bot.entity.position.distanceTo(entity.position);
|
|
64
|
-
}
|
|
65
|
-
eyeDistanceToEntity(entity) {
|
|
66
|
-
return static_1.AABBUtils.getEntityAABB(entity).distanceToVec(this.bot.entity.position.offset(0, this.bot.entity.height, 0));
|
|
67
|
-
}
|
|
68
|
-
eyeDistanceBetweenEntities(first, second) {
|
|
69
|
-
return static_1.AABBUtils.getEntityAABB(second).distanceToVec(first.position.offset(0, first.height, 0));
|
|
70
|
-
}
|
|
71
|
-
parseMetadata(packetMetadata, entityMetadata = {}) {
|
|
72
|
-
if (packetMetadata !== undefined) {
|
|
73
|
-
for (const { key, value } of packetMetadata) {
|
|
74
|
-
entityMetadata[key] = value;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return entityMetadata;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.EntityFunctions = EntityFunctions;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityFunctions = void 0;
|
|
4
|
+
const static_1 = require("./static");
|
|
5
|
+
class EntityFunctions {
|
|
6
|
+
constructor(bot) {
|
|
7
|
+
this.bot = bot;
|
|
8
|
+
this.healthSlot = 7;
|
|
9
|
+
this.healthSlot = Number(this.bot.version.split(".")[1]) <= 16 ? 7 : 9;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* TODO: Version specific right now. Generalize. Unknown method.
|
|
13
|
+
*
|
|
14
|
+
* Checks if main hand is activated.
|
|
15
|
+
* @returns boolean
|
|
16
|
+
*/
|
|
17
|
+
isMainHandActive(entity) {
|
|
18
|
+
return (entity !== null && entity !== void 0 ? entity : this.bot.entity).metadata[6] === 2; //as any & (1 | 0)) === (1 | 0);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* TODO: Version specific right now. Generalize. Unknown method.
|
|
22
|
+
*
|
|
23
|
+
* Checks if offhand is activated.
|
|
24
|
+
* @returns boolean
|
|
25
|
+
*/
|
|
26
|
+
isOffHandActive(entity) {
|
|
27
|
+
return (entity !== null && entity !== void 0 ? entity : this.bot.entity).metadata[6] === 3; //& (1 | 2)) === (1 | 2);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* TODO: Version specific right now. Generalize. Unknown method.
|
|
31
|
+
* @param metadata metadata from Prismarine-Entity Entity.
|
|
32
|
+
* @returns number
|
|
33
|
+
*/
|
|
34
|
+
getHealth(entity) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
entity !== null && entity !== void 0 ? entity : (entity = this.bot.entity);
|
|
37
|
+
const metadata = entity.metadata;
|
|
38
|
+
let health = Number(metadata[this.healthSlot]);
|
|
39
|
+
if (!health || health === 0)
|
|
40
|
+
health = entity === this.bot.entity ? (_a = this.bot.entity.health) !== null && _a !== void 0 ? _a : 0 : 0;
|
|
41
|
+
return health + ((_b = Number(metadata[this.healthSlot + 4])) !== null && _b !== void 0 ? _b : 0);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param metadata Must be FULL metadata object.
|
|
46
|
+
* @returns number
|
|
47
|
+
*/
|
|
48
|
+
getHealthFromMetadata(metadata) {
|
|
49
|
+
var _a;
|
|
50
|
+
return (_a = Number(metadata[this.healthSlot]) + Number(metadata[this.healthSlot + 4])) !== null && _a !== void 0 ? _a : undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* TODO: Version specific right now. Generalize. Unknown method.
|
|
54
|
+
* @param metadata metadata from Prismarine-Entity Entity.
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
getHealthChange(packetMetadata, entity) {
|
|
58
|
+
const oldHealth = this.getHealthFromMetadata(entity.metadata);
|
|
59
|
+
const newHealth = this.getHealthFromMetadata(this.parseMetadata(packetMetadata, entity.metadata));
|
|
60
|
+
return newHealth - oldHealth;
|
|
61
|
+
}
|
|
62
|
+
entityDistance(entity) {
|
|
63
|
+
return this.bot.entity.position.distanceTo(entity.position);
|
|
64
|
+
}
|
|
65
|
+
eyeDistanceToEntity(entity) {
|
|
66
|
+
return static_1.AABBUtils.getEntityAABB(entity).distanceToVec(this.bot.entity.position.offset(0, this.bot.entity.height, 0));
|
|
67
|
+
}
|
|
68
|
+
eyeDistanceBetweenEntities(first, second) {
|
|
69
|
+
return static_1.AABBUtils.getEntityAABB(second).distanceToVec(first.position.offset(0, first.height, 0));
|
|
70
|
+
}
|
|
71
|
+
parseMetadata(packetMetadata, entityMetadata = {}) {
|
|
72
|
+
if (packetMetadata !== undefined) {
|
|
73
|
+
for (const { key, value } of packetMetadata) {
|
|
74
|
+
entityMetadata[key] = value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return entityMetadata;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.EntityFunctions = EntityFunctions;
|
package/lib/filterFunctions.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { Entity } from "prismarine-entity";
|
|
2
|
-
import type { Bot } from "mineflayer";
|
|
3
|
-
import type { Vec3 } from "vec3";
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Inherit other bot names. May need to communciate to a server for this one. Or perhaps reference this once?
|
|
6
|
-
*/
|
|
7
|
-
export declare class FilterFunctions {
|
|
8
|
-
private bot;
|
|
9
|
-
specificNames: string[];
|
|
10
|
-
botNames: string[];
|
|
11
|
-
constructor(bot: Bot);
|
|
12
|
-
addBotName(name: string): void;
|
|
13
|
-
getNearestEntity(func: (entity: Entity, ...args: any[]) => boolean, ...args: any[]): Entity | null;
|
|
14
|
-
static getNearestEntity(bot: Bot, func: (entity: Entity, ...args: any[]) => boolean, ...args: any[]): Entity | null;
|
|
15
|
-
allButOtherBotsFilter(): Entity | null;
|
|
16
|
-
static allButOtherBotsFilter(bot: Bot, ...names: string[]): Entity | null;
|
|
17
|
-
specificNamesFilter(): Entity | null;
|
|
18
|
-
static specificNamesFilter(bot: Bot, ...names: string[]): Entity | null;
|
|
19
|
-
nearestCrystalFilter(): Entity | null;
|
|
20
|
-
static nearestCrystalFilter(bot: Bot): Entity | null;
|
|
21
|
-
crystalAtPosition(position: Vec3): Entity | null;
|
|
22
|
-
}
|
|
1
|
+
import type { Entity } from "prismarine-entity";
|
|
2
|
+
import type { Bot } from "mineflayer";
|
|
3
|
+
import type { Vec3 } from "vec3";
|
|
4
|
+
/**
|
|
5
|
+
* TODO: Inherit other bot names. May need to communciate to a server for this one. Or perhaps reference this once?
|
|
6
|
+
*/
|
|
7
|
+
export declare class FilterFunctions {
|
|
8
|
+
private bot;
|
|
9
|
+
specificNames: string[];
|
|
10
|
+
botNames: string[];
|
|
11
|
+
constructor(bot: Bot);
|
|
12
|
+
addBotName(name: string): void;
|
|
13
|
+
getNearestEntity(func: (entity: Entity, ...args: any[]) => boolean, ...args: any[]): Entity | null;
|
|
14
|
+
static getNearestEntity(bot: Bot, func: (entity: Entity, ...args: any[]) => boolean, ...args: any[]): Entity | null;
|
|
15
|
+
allButOtherBotsFilter(): Entity | null;
|
|
16
|
+
static allButOtherBotsFilter(bot: Bot, ...names: string[]): Entity | null;
|
|
17
|
+
specificNamesFilter(): Entity | null;
|
|
18
|
+
static specificNamesFilter(bot: Bot, ...names: string[]): Entity | null;
|
|
19
|
+
nearestCrystalFilter(): Entity | null;
|
|
20
|
+
static nearestCrystalFilter(bot: Bot): Entity | null;
|
|
21
|
+
crystalAtPosition(position: Vec3): Entity | null;
|
|
22
|
+
}
|
package/lib/filterFunctions.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FilterFunctions = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Inherit other bot names. May need to communciate to a server for this one. Or perhaps reference this once?
|
|
6
|
-
*/
|
|
7
|
-
class FilterFunctions {
|
|
8
|
-
constructor(bot) {
|
|
9
|
-
this.bot = bot;
|
|
10
|
-
this.specificNames = [];
|
|
11
|
-
this.botNames = [];
|
|
12
|
-
}
|
|
13
|
-
addBotName(name) {
|
|
14
|
-
this.botNames.push(name);
|
|
15
|
-
}
|
|
16
|
-
getNearestEntity(func, ...args) {
|
|
17
|
-
return this.bot.nearestEntity((entity) => func(entity, ...args));
|
|
18
|
-
}
|
|
19
|
-
static getNearestEntity(bot, func, ...args) {
|
|
20
|
-
return bot.nearestEntity((entity) => func(entity, ...args));
|
|
21
|
-
}
|
|
22
|
-
allButOtherBotsFilter() {
|
|
23
|
-
return this.getNearestEntity((e) => { var _a, _b, _c; return e.type === "player" && ((_c = !((_a = this.botNames) === null || _a === void 0 ? void 0 : _a.includes((_b = e.username) !== null && _b !== void 0 ? _b : ""))) !== null && _c !== void 0 ? _c : true); });
|
|
24
|
-
}
|
|
25
|
-
static allButOtherBotsFilter(bot, ...names) {
|
|
26
|
-
return FilterFunctions.getNearestEntity(bot, (e) => { var _a; return e.type === "player" && !names.includes((_a = e.username) !== null && _a !== void 0 ? _a : ""); });
|
|
27
|
-
}
|
|
28
|
-
specificNamesFilter() {
|
|
29
|
-
return this.getNearestEntity((e) => { var _a, _b, _c; return e.type === "player" && ((_c = (_a = this.specificNames) === null || _a === void 0 ? void 0 : _a.includes((_b = e.username) !== null && _b !== void 0 ? _b : "")) !== null && _c !== void 0 ? _c : true); });
|
|
30
|
-
}
|
|
31
|
-
static specificNamesFilter(bot, ...names) {
|
|
32
|
-
return FilterFunctions.getNearestEntity(bot, (e) => { var _a; return e.type === "player" && names.includes((_a = e.username) !== null && _a !== void 0 ? _a : ""); });
|
|
33
|
-
}
|
|
34
|
-
nearestCrystalFilter() {
|
|
35
|
-
return this.getNearestEntity((e) => e.name === "ender_crystal");
|
|
36
|
-
}
|
|
37
|
-
static nearestCrystalFilter(bot) {
|
|
38
|
-
return FilterFunctions.getNearestEntity(bot, (e) => e.name === "ender_crystal");
|
|
39
|
-
}
|
|
40
|
-
crystalAtPosition(position) {
|
|
41
|
-
return this.getNearestEntity((entity) => entity.position.offset(-0.5, -1, -0.5).equals(position));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.FilterFunctions = FilterFunctions;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterFunctions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* TODO: Inherit other bot names. May need to communciate to a server for this one. Or perhaps reference this once?
|
|
6
|
+
*/
|
|
7
|
+
class FilterFunctions {
|
|
8
|
+
constructor(bot) {
|
|
9
|
+
this.bot = bot;
|
|
10
|
+
this.specificNames = [];
|
|
11
|
+
this.botNames = [];
|
|
12
|
+
}
|
|
13
|
+
addBotName(name) {
|
|
14
|
+
this.botNames.push(name);
|
|
15
|
+
}
|
|
16
|
+
getNearestEntity(func, ...args) {
|
|
17
|
+
return this.bot.nearestEntity((entity) => func(entity, ...args));
|
|
18
|
+
}
|
|
19
|
+
static getNearestEntity(bot, func, ...args) {
|
|
20
|
+
return bot.nearestEntity((entity) => func(entity, ...args));
|
|
21
|
+
}
|
|
22
|
+
allButOtherBotsFilter() {
|
|
23
|
+
return this.getNearestEntity((e) => { var _a, _b, _c; return e.type === "player" && ((_c = !((_a = this.botNames) === null || _a === void 0 ? void 0 : _a.includes((_b = e.username) !== null && _b !== void 0 ? _b : ""))) !== null && _c !== void 0 ? _c : true); });
|
|
24
|
+
}
|
|
25
|
+
static allButOtherBotsFilter(bot, ...names) {
|
|
26
|
+
return FilterFunctions.getNearestEntity(bot, (e) => { var _a; return e.type === "player" && !names.includes((_a = e.username) !== null && _a !== void 0 ? _a : ""); });
|
|
27
|
+
}
|
|
28
|
+
specificNamesFilter() {
|
|
29
|
+
return this.getNearestEntity((e) => { var _a, _b, _c; return e.type === "player" && ((_c = (_a = this.specificNames) === null || _a === void 0 ? void 0 : _a.includes((_b = e.username) !== null && _b !== void 0 ? _b : "")) !== null && _c !== void 0 ? _c : true); });
|
|
30
|
+
}
|
|
31
|
+
static specificNamesFilter(bot, ...names) {
|
|
32
|
+
return FilterFunctions.getNearestEntity(bot, (e) => { var _a; return e.type === "player" && names.includes((_a = e.username) !== null && _a !== void 0 ? _a : ""); });
|
|
33
|
+
}
|
|
34
|
+
nearestCrystalFilter() {
|
|
35
|
+
return this.getNearestEntity((e) => e.name === "ender_crystal");
|
|
36
|
+
}
|
|
37
|
+
static nearestCrystalFilter(bot) {
|
|
38
|
+
return FilterFunctions.getNearestEntity(bot, (e) => e.name === "ender_crystal");
|
|
39
|
+
}
|
|
40
|
+
crystalAtPosition(position) {
|
|
41
|
+
return this.getNearestEntity((entity) => entity.position.offset(-0.5, -1, -0.5).equals(position));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.FilterFunctions = FilterFunctions;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { Bot } from "mineflayer";
|
|
2
|
-
import { UtilFunctions } from "./utilFunctions";
|
|
3
|
-
declare module "mineflayer" {
|
|
4
|
-
interface Bot {
|
|
5
|
-
util: UtilFunctions;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
declare module "prismarine-entity" {
|
|
9
|
-
interface Entity {
|
|
10
|
-
attributes: {
|
|
11
|
-
[index: string]: {
|
|
12
|
-
value: number;
|
|
13
|
-
modifiers: any[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export default function inject(bot: Bot): void;
|
|
19
|
-
export { AABB } from "./calcs/aabb";
|
|
20
|
-
export { InterceptFunctions } from "./calcs/intercept";
|
|
21
|
-
export { RaycastIterator, BlockFace } from "./calcs/iterators";
|
|
22
|
-
export { AABBUtils, MathUtils, Task } from "./static";
|
|
1
|
+
import type { Bot } from "mineflayer";
|
|
2
|
+
import { UtilFunctions } from "./utilFunctions";
|
|
3
|
+
declare module "mineflayer" {
|
|
4
|
+
interface Bot {
|
|
5
|
+
util: UtilFunctions;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare module "prismarine-entity" {
|
|
9
|
+
interface Entity {
|
|
10
|
+
attributes: {
|
|
11
|
+
[index: string]: {
|
|
12
|
+
value: number;
|
|
13
|
+
modifiers: any[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default function inject(bot: Bot): void;
|
|
19
|
+
export { AABB } from "./calcs/aabb";
|
|
20
|
+
export { InterceptFunctions } from "./calcs/intercept";
|
|
21
|
+
export { RaycastIterator, BlockFace } from "./calcs/iterators";
|
|
22
|
+
export { AABBUtils, MathUtils, Task } from "./static";
|
package/lib/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Task = exports.MathUtils = exports.AABBUtils = exports.BlockFace = exports.RaycastIterator = exports.InterceptFunctions = exports.AABB = void 0;
|
|
4
|
-
const utilFunctions_1 = require("./utilFunctions");
|
|
5
|
-
function inject(bot) {
|
|
6
|
-
bot.util = new utilFunctions_1.UtilFunctions(bot);
|
|
7
|
-
}
|
|
8
|
-
exports.default = inject;
|
|
9
|
-
var aabb_1 = require("./calcs/aabb");
|
|
10
|
-
Object.defineProperty(exports, "AABB", { enumerable: true, get: function () { return aabb_1.AABB; } });
|
|
11
|
-
var intercept_1 = require("./calcs/intercept");
|
|
12
|
-
Object.defineProperty(exports, "InterceptFunctions", { enumerable: true, get: function () { return intercept_1.InterceptFunctions; } });
|
|
13
|
-
var iterators_1 = require("./calcs/iterators");
|
|
14
|
-
Object.defineProperty(exports, "RaycastIterator", { enumerable: true, get: function () { return iterators_1.RaycastIterator; } });
|
|
15
|
-
Object.defineProperty(exports, "BlockFace", { enumerable: true, get: function () { return iterators_1.BlockFace; } });
|
|
16
|
-
var static_1 = require("./static");
|
|
17
|
-
Object.defineProperty(exports, "AABBUtils", { enumerable: true, get: function () { return static_1.AABBUtils; } });
|
|
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; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Task = exports.MathUtils = exports.AABBUtils = exports.BlockFace = exports.RaycastIterator = exports.InterceptFunctions = exports.AABB = void 0;
|
|
4
|
+
const utilFunctions_1 = require("./utilFunctions");
|
|
5
|
+
function inject(bot) {
|
|
6
|
+
bot.util = new utilFunctions_1.UtilFunctions(bot);
|
|
7
|
+
}
|
|
8
|
+
exports.default = inject;
|
|
9
|
+
var aabb_1 = require("./calcs/aabb");
|
|
10
|
+
Object.defineProperty(exports, "AABB", { enumerable: true, get: function () { return aabb_1.AABB; } });
|
|
11
|
+
var intercept_1 = require("./calcs/intercept");
|
|
12
|
+
Object.defineProperty(exports, "InterceptFunctions", { enumerable: true, get: function () { return intercept_1.InterceptFunctions; } });
|
|
13
|
+
var iterators_1 = require("./calcs/iterators");
|
|
14
|
+
Object.defineProperty(exports, "RaycastIterator", { enumerable: true, get: function () { return iterators_1.RaycastIterator; } });
|
|
15
|
+
Object.defineProperty(exports, "BlockFace", { enumerable: true, get: function () { return iterators_1.BlockFace; } });
|
|
16
|
+
var static_1 = require("./static");
|
|
17
|
+
Object.defineProperty(exports, "AABBUtils", { enumerable: true, get: function () { return static_1.AABBUtils; } });
|
|
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; } });
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { Bot, EquipmentDestination } from "mineflayer";
|
|
2
|
-
import { Item } from "prismarine-item";
|
|
3
|
-
/**
|
|
4
|
-
* Error codes:
|
|
5
|
-
*
|
|
6
|
-
* 0 = completed successfully.
|
|
7
|
-
*
|
|
8
|
-
* 1 = Item is already equipped.
|
|
9
|
-
*
|
|
10
|
-
* 2 = Item could not be found.
|
|
11
|
-
*
|
|
12
|
-
* 3 = We are currently equipping an item.
|
|
13
|
-
*/
|
|
14
|
-
export declare class InventoryFunctions {
|
|
15
|
-
bot: Bot;
|
|
16
|
-
private _equippingMainHand;
|
|
17
|
-
private _equippingOffHand;
|
|
18
|
-
private _equippingOtherSlot;
|
|
19
|
-
usingMainHand: boolean;
|
|
20
|
-
usingOffHand: boolean;
|
|
21
|
-
constructor(bot: Bot);
|
|
22
|
-
set equippingOtherSlot(value: boolean);
|
|
23
|
-
get equippingOtherSlot(): boolean;
|
|
24
|
-
set equippingMainHand(value: boolean);
|
|
25
|
-
get equippingMainHand(): boolean;
|
|
26
|
-
set equippingOffHand(value: boolean);
|
|
27
|
-
get equippingOffHand(): boolean;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { Bot, EquipmentDestination } from "mineflayer";
|
|
2
|
+
import { Item } from "prismarine-item";
|
|
3
|
+
/**
|
|
4
|
+
* Error codes:
|
|
5
|
+
*
|
|
6
|
+
* 0 = completed successfully.
|
|
7
|
+
*
|
|
8
|
+
* 1 = Item is already equipped.
|
|
9
|
+
*
|
|
10
|
+
* 2 = Item could not be found.
|
|
11
|
+
*
|
|
12
|
+
* 3 = We are currently equipping an item.
|
|
13
|
+
*/
|
|
14
|
+
export declare class InventoryFunctions {
|
|
15
|
+
bot: Bot;
|
|
16
|
+
private _equippingMainHand;
|
|
17
|
+
private _equippingOffHand;
|
|
18
|
+
private _equippingOtherSlot;
|
|
19
|
+
usingMainHand: boolean;
|
|
20
|
+
usingOffHand: boolean;
|
|
21
|
+
constructor(bot: Bot);
|
|
22
|
+
set equippingOtherSlot(value: boolean);
|
|
23
|
+
get equippingOtherSlot(): boolean;
|
|
24
|
+
set equippingMainHand(value: boolean);
|
|
25
|
+
get equippingMainHand(): boolean;
|
|
26
|
+
set equippingOffHand(value: boolean);
|
|
27
|
+
get equippingOffHand(): boolean;
|
|
28
|
+
get equipmentSlots(): EquipmentDestination[];
|
|
29
|
+
getAllItems(): Item[];
|
|
30
|
+
getAllItemsExceptCurrent(current: EquipmentDestination): Item[];
|
|
31
|
+
getHandWithItem(offhand?: boolean): Item | null;
|
|
32
|
+
getHand(offhand?: boolean): "hand" | "off-hand";
|
|
33
|
+
findItemByID(itemId: number, metadata?: number): Item | null;
|
|
34
|
+
findItem(name: string, metadata?: number): Item | null;
|
|
35
|
+
has(name: string, metadata?: number): boolean;
|
|
36
|
+
equipItemRaw(item: Item, dest: EquipmentDestination): Promise<boolean>;
|
|
37
|
+
customEquip(item: Item, destination: EquipmentDestination, retries?: number): Promise<boolean>;
|
|
38
|
+
}
|