@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.
package/lib/entityFunctions.d.ts
CHANGED
package/lib/entityFunctions.js
CHANGED
|
@@ -67,7 +67,7 @@ class EntityFunctions {
|
|
|
67
67
|
*/
|
|
68
68
|
getHealthFromMetadata(metadata) {
|
|
69
69
|
var _a;
|
|
70
|
-
return (_a =
|
|
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:
|
|
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) {
|
package/lib/static/aabbUtil.d.ts
CHANGED
package/lib/static/aabbUtil.js
CHANGED
|
@@ -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
|
}
|