@nxg-org/mineflayer-physics-util
Version:
Provides functionality for more accurate entity and projectile tracking.
82 lines (81 loc) • 2.74 kB
TypeScript
import { AABB } from "@nxg-org/mineflayer-util-plugin";
import type { Bot, Effect } from "mineflayer";
import { Vec3 } from "vec3";
import { ControlStateHandler } from "../player/playerControls";
import { PlayerState } from "./playerState";
import { PlayerPoses } from "./poses";
import { IPhysics } from "../engines";
import { Entity } from "prismarine-entity";
import { IEntityState } from ".";
export declare class EntityState implements IEntityState {
ctx: IPhysics;
height: number;
halfWidth: number;
pos: Vec3;
vel: Vec3;
onGround: boolean;
yaw: number;
pitch: number;
control: ControlStateHandler;
age: number;
isInWater: boolean;
isInLava: boolean;
isInWeb: boolean;
fallFlying: boolean;
validElytraEquipped: boolean;
isCollidedHorizontally: boolean;
isCollidedVertically: boolean;
jumpTicks: number;
jumpQueued: boolean;
onClimbable: boolean;
sneakCollision: boolean;
attributes: Entity["attributes"];
isUsingItem: boolean;
isUsingMainHand: boolean;
isUsingOffHand: boolean;
jumpBoost: number;
speed: number;
slowness: number;
dolphinsGrace: number;
slowFalling: number;
levitation: number;
depthStrider: number;
effects: Effect[];
pose: PlayerPoses;
fireworkRocketDuration: number;
supportingBlockPos: Vec3 | null;
/**
* Deprecated compatibility alias for fallFlying.
*/
get elytraFlying(): boolean;
set elytraFlying(value: boolean);
constructor(ctx: IPhysics, height: number, halfWidth: number, pos: Vec3, vel: Vec3, onGround: boolean, yaw: number, pitch: number, control?: ControlStateHandler);
static CREATE_FROM_BOT(ctx: IPhysics, bot: Bot): EntityState;
static CREATE_FROM_ENTITY(ctx: IPhysics, entity: Entity): EntityState;
static CREATE_FROM_PLAYER_STATE(ctx: IPhysics, state: PlayerState): EntityState;
/**
* Slightly different from the other two, use a pre-built object (assuming cloned) material.
* @param ctx Physics instance.
* @param raw CONSUMEABLE, build this with clones.
* @returns PhysicsState
*/
static CREATE_RAW(ctx: IPhysics, raw: IEntityState): EntityState;
updateFromBot(bot: Bot): EntityState;
updateFromEntity(entity: Entity, all?: boolean): this;
updateFromRaw(other: IEntityState): this;
applyToBot(bot: Bot): this;
/**
* No idea when you'd use this.
*/
applyToEntity(entity: Entity): this;
clone(): EntityState;
merge(other: EntityState): this;
clearControlStates(): EntityState;
/**
* needs to be updated.
* @returns AABB
*/
getBB(): AABB;
lookAt(vec3: Vec3): void;
look(yaw: number, pitch: number): void;
}