@nxg-org/mineflayer-util-plugin 1.7.5 → 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.
@@ -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
- offset(x: number, y: number, z: number): this;
43
- offsetVec(vec: Vec3): this;
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]).offsetVec(offset);
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;
@@ -131,7 +131,7 @@ class AABB {
131
131
  this.maxZ += z;
132
132
  return this;
133
133
  }
134
- offset(x, y, z) {
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
- offsetVec(vec) {
143
+ translateVec(vec) {
144
144
  this.minX += vec.x;
145
145
  this.minY += vec.y;
146
146
  this.minZ += vec.z;
@@ -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
- this.bot._client.write("position", Object.assign(Object.assign({}, pos), { onGround: this.bot.entity.onGround }));
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);
@@ -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
- const { x, y, z } = entity.position;
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).offsetVec(position);
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
- const { x, y, z } = entity.position;
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 = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxg-org/mineflayer-util-plugin",
3
- "version": "1.7.5",
3
+ "version": "1.7.6",
4
4
  "description": "mineflayer utils for NextGEN mineflayer plugins.",
5
5
  "keywords": [
6
6
  "mineflayer",