UNPKG

@nxg-org/mineflayer-physics-util

Version:

Provides functionality for more accurate entity and projectile tracking.

23 lines (22 loc) 1.5 kB
import { ControlStateHandler } from "../physics/player"; import { EPhysicsCtx } from "../physics/settings"; import { IEntityState } from "../physics/states"; import { IPhysics } from "../physics/engines"; import { Entity } from "prismarine-entity"; import { Vec3 } from "vec3"; export type SimulationGoal = (state: IEntityState, ticks: number) => boolean | ((state: IEntityState) => boolean); export type OnGoalReachFunction = (state: IEntityState) => void; export type Controller = (state: IEntityState, ticks: number) => void; export declare class BaseSimulator { readonly ctx: IPhysics; constructor(ctx: IPhysics); predictGenerator(simCtx: EPhysicsCtx, world: any, ticks?: number, controls?: ControlStateHandler): Generator<IEntityState, EPhysicsCtx, unknown>; predictForward(target: Entity, world: any, ticks?: number, controls?: ControlStateHandler): IEntityState; predictForwardRaw(simCtx: EPhysicsCtx, world: any, ticks?: number, controls?: ControlStateHandler): IEntityState; simulateUntil(goal: SimulationGoal, onGoalReach: OnGoalReachFunction, controller: Controller, simCtx: EPhysicsCtx, world: any, ticks?: number): IEntityState; static getReached(...path: Vec3[]): SimulationGoal; static getCleanupPosition(...path: Vec3[]): OnGoalReachFunction; static buildFullController(...controllers: Controller[]): Controller; static buildAnyGoal(...goals: SimulationGoal[]): SimulationGoal; static buildAllGoal(...goals: SimulationGoal[]): SimulationGoal; }