UNPKG

@nxg-org/mineflayer-physics-util

Version:

Provides functionality for more accurate entity and projectile tracking.

32 lines (31 loc) 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.playerPoseCtx = exports.PlayerPoses = void 0; exports.getCollider = getCollider; const mineflayer_util_plugin_1 = require("@nxg-org/mineflayer-util-plugin"); //0: STANDING, 1: FALL_FLYING, 2: SLEEPING, 3: SWIMMING, 4: SPIN_ATTACK, 5: SNEAKING, 6: LONG_JUMPING, 7: DYING var PlayerPoses; (function (PlayerPoses) { PlayerPoses[PlayerPoses["STANDING"] = 0] = "STANDING"; PlayerPoses[PlayerPoses["FALL_FLYING"] = 1] = "FALL_FLYING"; PlayerPoses[PlayerPoses["SLEEPING"] = 2] = "SLEEPING"; PlayerPoses[PlayerPoses["SWIMMING"] = 3] = "SWIMMING"; PlayerPoses[PlayerPoses["SPIN_ATTACK"] = 4] = "SPIN_ATTACK"; PlayerPoses[PlayerPoses["SNEAKING"] = 5] = "SNEAKING"; PlayerPoses[PlayerPoses["LONG_JUMPING"] = 6] = "LONG_JUMPING"; PlayerPoses[PlayerPoses["DYING"] = 7] = "DYING"; })(PlayerPoses || (exports.PlayerPoses = PlayerPoses = {})); exports.playerPoseCtx = { 0: { width: 0.6, height: 1.8 }, 1: { width: 0.2, height: 0.2 }, 2: { width: 0.6, height: 0.6 }, 3: { width: 0.6, height: 0.6 }, 4: { width: 0.6, height: 0.6 }, 5: { width: 0.6, height: 0.6 }, 6: { width: 0.6, height: 1.5 }, 7: { width: 0.2, height: 0.2 }, }; function getCollider(entityPose, middleBottomPos) { const { width, height } = exports.playerPoseCtx[entityPose]; return new mineflayer_util_plugin_1.AABB(-width / 2, 0, -width / 2, width / 2, height, width / 2).translate(middleBottomPos.x, middleBottomPos.y, middleBottomPos.z); }