@nxg-org/mineflayer-util-plugin 1.7.4 → 1.7.6
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/calcs/aabb.d.ts +2 -2
- package/lib/calcs/aabb.js +4 -4
- package/lib/movementFunctions.js +4 -1
- package/lib/static/aabbUtil.js +3 -5
- package/package.json +1 -1
package/lib/calcs/aabb.d.ts
CHANGED
|
@@ -39,8 +39,8 @@ export declare class AABB {
|
|
|
39
39
|
extend(dx: number, dy: number, dz: number): this;
|
|
40
40
|
contract(x: number, y: number, z: number): this;
|
|
41
41
|
expand(x: number, y: number, z: number): this;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
translate(x: number, y: number, z: number): this;
|
|
43
|
+
translateVec(vec: Vec3): this;
|
|
44
44
|
computeOffsetX(other: AABB, offsetX: number): number;
|
|
45
45
|
computeOffsetY(other: AABB, offsetY: number): number;
|
|
46
46
|
computeOffsetZ(other: AABB, offsetZ: number): number;
|
package/lib/calcs/aabb.js
CHANGED
|
@@ -22,7 +22,7 @@ class AABB {
|
|
|
22
22
|
return new AABB(min.x, min.y, min.z, min.x + 1.0, min.y + 1.0, min.z + 1.0);
|
|
23
23
|
}
|
|
24
24
|
static fromShape(pts, offset = emptyVec) {
|
|
25
|
-
return new AABB(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]).
|
|
25
|
+
return new AABB(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]).translateVec(offset);
|
|
26
26
|
}
|
|
27
27
|
set(x0, y0, z0, x1, y1, z1) {
|
|
28
28
|
this.minX = x0;
|
|
@@ -42,7 +42,7 @@ class AABB {
|
|
|
42
42
|
return new vec3_1.Vec3(this.maxX, this.maxY, this.maxZ);
|
|
43
43
|
}
|
|
44
44
|
bottomMiddlePoint() {
|
|
45
|
-
return new vec3_1.Vec3(
|
|
45
|
+
return new vec3_1.Vec3((this.maxX - this.minX) / 2, this.minY, (this.maxZ - this.minZ) / 2);
|
|
46
46
|
}
|
|
47
47
|
heightAndWidths() {
|
|
48
48
|
return new vec3_1.Vec3(this.maxX - this.minX, this.maxY - this.minY, this.maxZ - this.minZ);
|
|
@@ -131,7 +131,7 @@ class AABB {
|
|
|
131
131
|
this.maxZ += z;
|
|
132
132
|
return this;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
translate(x, y, z) {
|
|
135
135
|
this.minX += x;
|
|
136
136
|
this.minY += y;
|
|
137
137
|
this.minZ += z;
|
|
@@ -140,7 +140,7 @@ class AABB {
|
|
|
140
140
|
this.maxZ += z;
|
|
141
141
|
return this;
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
translateVec(vec) {
|
|
144
144
|
this.minX += vec.x;
|
|
145
145
|
this.minY += vec.y;
|
|
146
146
|
this.minZ += vec.z;
|
package/lib/movementFunctions.js
CHANGED
|
@@ -33,7 +33,10 @@ class MovementFunctions {
|
|
|
33
33
|
}
|
|
34
34
|
lazyTeleport(endPos, steps = 1, update = false) {
|
|
35
35
|
for (const pos of interpolate(this.bot.entity.position, endPos, steps)) {
|
|
36
|
-
|
|
36
|
+
const block = this.bot.blockAt(pos);
|
|
37
|
+
if (!block)
|
|
38
|
+
break;
|
|
39
|
+
this.bot._client.write("position", Object.assign(Object.assign({}, pos), { onGround: block.transparent }));
|
|
37
40
|
}
|
|
38
41
|
if (update)
|
|
39
42
|
this.bot.entity.position.set(endPos.x, endPos.y, endPos.z);
|
package/lib/static/aabbUtil.js
CHANGED
|
@@ -26,18 +26,16 @@ var AABBUtils;
|
|
|
26
26
|
AABBUtils.getEntityAABB = getEntityAABB;
|
|
27
27
|
function getPlayerAABB(entity) {
|
|
28
28
|
const w = entity.width ? entity.width / 2 : 0.6;
|
|
29
|
-
|
|
30
|
-
return new aabb_1.AABB(-w, 0, -w, w, entity.height ? entity.height + 0.18 : 1.8, w).offset(x, y, z);
|
|
29
|
+
return new aabb_1.AABB(-w, 0, -w, w, entity.height ? entity.height + 0.18 : 1.8, w).translateVec(entity.position);
|
|
31
30
|
}
|
|
32
31
|
AABBUtils.getPlayerAABB = getPlayerAABB;
|
|
33
32
|
function getPlayerAABBRaw(position, height = 1.8) {
|
|
34
|
-
return new aabb_1.AABB(-0.6, 0, -0.6, 0.6, height, 0.6).
|
|
33
|
+
return new aabb_1.AABB(-0.6, 0, -0.6, 0.6, height, 0.6).translateVec(position);
|
|
35
34
|
}
|
|
36
35
|
AABBUtils.getPlayerAABBRaw = getPlayerAABBRaw;
|
|
37
36
|
function getEntityAABBRaw(entity) {
|
|
38
37
|
const w = entity.width ? entity.width / 2 : entity.height / 2;
|
|
39
|
-
|
|
40
|
-
return new aabb_1.AABB(-w, 0, -w, w, entity.height, w).offset(x, y, z);
|
|
38
|
+
return new aabb_1.AABB(-w, 0, -w, w, entity.height, w).translateVec(entity.position);
|
|
41
39
|
}
|
|
42
40
|
AABBUtils.getEntityAABBRaw = getEntityAABBRaw;
|
|
43
41
|
})(AABBUtils = exports.AABBUtils || (exports.AABBUtils = {}));
|