@nxg-org/mineflayer-util-plugin 1.3.13 → 1.3.14

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.
@@ -52,7 +52,7 @@ export declare class EntityFunctions {
52
52
  getEntityAABBRaw(entity: {
53
53
  position: Vec3;
54
54
  height: number;
55
- width: number;
55
+ width?: number;
56
56
  }): AABB;
57
57
  private parseMetadata;
58
58
  }
@@ -67,7 +67,7 @@ class EntityFunctions {
67
67
  */
68
68
  getHealthFromMetadata(metadata) {
69
69
  var _a;
70
- return (_a = (Number(metadata[this.healthSlot]) + Number(metadata[this.healthSlot + 4]))) !== null && _a !== void 0 ? _a : undefined;
70
+ return (_a = Number(metadata[this.healthSlot]) + Number(metadata[this.healthSlot + 4])) !== null && _a !== void 0 ? _a : undefined;
71
71
  }
72
72
  /**
73
73
  * TODO: Version specific right now. Generalize. Unknown method.
@@ -91,7 +91,8 @@ class EntityFunctions {
91
91
  case "player":
92
92
  return this.getPlayerAABB({ position: entity.position });
93
93
  case "mob":
94
- default: //TODO: Implement better AABBs. However, this may just be correct.
94
+ default:
95
+ //TODO: Implement better AABBs. However, this may just be correct.
95
96
  return this.getEntityAABBRaw({ position: entity.position, height: entity.height, width: (_a = entity.width) !== null && _a !== void 0 ? _a : entity.height });
96
97
  }
97
98
  }
@@ -99,11 +100,10 @@ class EntityFunctions {
99
100
  return this.getEntityAABBRaw({ position: entity.position, height: 1.8, width: 0.3 });
100
101
  }
101
102
  getEntityAABBRaw(entity) {
102
- const w = entity.width / 2;
103
+ const w = entity.width ? entity.width / 2 : entity.height / 2;
103
104
  const { x, y, z } = entity.position;
104
105
  return new aabb_1.AABB(-w, 0, -w, w, entity.height, w).offset(x, y, z);
105
106
  }
106
- //Stolen from mineflayer.
107
107
  parseMetadata(packetMetadata, entityMetadata = {}) {
108
108
  if (packetMetadata !== undefined) {
109
109
  for (const { key, value } of packetMetadata) {
@@ -16,6 +16,6 @@ export declare namespace AABBUtils {
16
16
  function getEntityAABBRaw(entity: {
17
17
  position: Vec3;
18
18
  height: number;
19
- width: number;
19
+ width?: number;
20
20
  }): AABB;
21
21
  }
@@ -30,7 +30,7 @@ var AABBUtils;
30
30
  }
31
31
  AABBUtils.getPlayerAABB = getPlayerAABB;
32
32
  function getEntityAABBRaw(entity) {
33
- const w = entity.width / 2;
33
+ const w = entity.width ? entity.width / 2 : entity.height / 2;
34
34
  const { x, y, z } = entity.position;
35
35
  return new aabb_1.AABB(-w, 0, -w, w, entity.height, w).offset(x, y, z);
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxg-org/mineflayer-util-plugin",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "mineflayer utils for NextGEN mineflayer plugins.",
5
5
  "keywords": [
6
6
  "mineflayer",