@nxg-org/mineflayer-util-plugin 1.7.0 → 1.7.2
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.
|
@@ -9,15 +9,17 @@ class RayTraceFunctions {
|
|
|
9
9
|
this.bot = bot;
|
|
10
10
|
}
|
|
11
11
|
entityRaytrace(startPos, dir, maxDistance = 3.5, matcher) {
|
|
12
|
+
matcher || (matcher = (e) => true);
|
|
12
13
|
const aabbMap = {};
|
|
13
14
|
Object.values(this.bot.entities)
|
|
14
|
-
.filter((e) => e.username !== this.bot.entity.username)
|
|
15
|
+
.filter((e) => e.username !== this.bot.entity.username && matcher(e))
|
|
15
16
|
.forEach((e) => (aabbMap[e.id] = static_1.AABBUtils.getEntityAABB(e)));
|
|
16
17
|
return this.entityRaytraceRaw(startPos, dir, aabbMap, maxDistance, matcher);
|
|
17
18
|
}
|
|
18
19
|
entityRaytraceRaw(startPos, dir, aabbMap, maxDistance = 3.5, matcher) {
|
|
19
20
|
var _a;
|
|
20
21
|
matcher || (matcher = (e) => true);
|
|
22
|
+
const eyePos = this.bot.entity.position.offset(0, this.bot.entity.height, 0);
|
|
21
23
|
Object.entries(aabbMap).forEach(([id, bb]) => {
|
|
22
24
|
if (bb.distanceToVec(eyePos) > maxDistance)
|
|
23
25
|
delete aabbMap[id];
|
|
@@ -27,7 +29,6 @@ class RayTraceFunctions {
|
|
|
27
29
|
if (returnVal && Object.keys(aabbMap).length === 0)
|
|
28
30
|
return returnVal;
|
|
29
31
|
maxDistance = (_a = returnVal === null || returnVal === void 0 ? void 0 : returnVal.intersect.distanceTo(startPos)) !== null && _a !== void 0 ? _a : maxDistance;
|
|
30
|
-
const eyePos = this.bot.entity.position.offset(0, this.bot.entity.height, 0);
|
|
31
32
|
const iterator = new iterators_1.RaycastIterator(startPos, dir, maxDistance);
|
|
32
33
|
for (const id in aabbMap) {
|
|
33
34
|
const aabb = aabbMap[id];
|