@nxg-org/mineflayer-physics-util 1.8.10 → 1.8.12
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.
|
@@ -4,19 +4,20 @@ import type { Bot } from "mineflayer";
|
|
|
4
4
|
import { Entity } from "prismarine-entity";
|
|
5
5
|
import { Vec3 } from "vec3";
|
|
6
6
|
import { IPhysics } from "../engines/IPhysics";
|
|
7
|
-
import { IEntityState } from "../states";
|
|
7
|
+
import { EntityState, IEntityState } from "../states";
|
|
8
8
|
import { PlayerPoses } from "../states/poses";
|
|
9
9
|
import { PhysicsWorldSettings } from "./physicsSettings";
|
|
10
|
+
import { PlayerState } from "../states";
|
|
10
11
|
export declare const emptyVec: Vec3;
|
|
11
12
|
type CollisionContext = {
|
|
12
13
|
blockEffects: boolean;
|
|
13
14
|
affectedAfterCollision: boolean;
|
|
14
15
|
};
|
|
15
|
-
export declare class EPhysicsCtx {
|
|
16
|
+
export declare class EPhysicsCtx<State extends IEntityState = IEntityState> {
|
|
16
17
|
readonly ctx: IPhysics;
|
|
17
18
|
readonly worldSettings: PhysicsWorldSettings;
|
|
18
19
|
pose: PlayerPoses;
|
|
19
|
-
readonly state:
|
|
20
|
+
readonly state: State;
|
|
20
21
|
readonly entityType: md.Entity;
|
|
21
22
|
static loadData: (data: md.IndexedData) => void;
|
|
22
23
|
static entityConstructor: new (id: number) => Entity;
|
|
@@ -41,12 +42,12 @@ export declare class EPhysicsCtx {
|
|
|
41
42
|
doSolidCollisions: boolean;
|
|
42
43
|
doLiquidCollisions: boolean;
|
|
43
44
|
collisionBehavior: CollisionContext;
|
|
44
|
-
constructor(ctx: IPhysics, worldSettings: PhysicsWorldSettings, pose: PlayerPoses, state:
|
|
45
|
-
static FROM_BOT(ctx: IPhysics, bot: Bot, settings?: PhysicsWorldSettings): EPhysicsCtx
|
|
46
|
-
static FROM_ENTITY(ctx: IPhysics, entity: Entity, settings?: PhysicsWorldSettings): EPhysicsCtx
|
|
47
|
-
static FROM_ENTITY_TYPE(ctx: IPhysics, entityType: md.Entity, options?: Partial<Entity>, settings?: PhysicsWorldSettings): EPhysicsCtx
|
|
48
|
-
static FROM_ENTITY_STATE(ctx: IPhysics, entityState: IEntityState, entityType?: md.Entity, settings?: PhysicsWorldSettings): EPhysicsCtx
|
|
49
|
-
clone(): EPhysicsCtx
|
|
45
|
+
constructor(ctx: IPhysics, worldSettings: PhysicsWorldSettings, pose: PlayerPoses, state: State, entityType?: md.Entity);
|
|
46
|
+
static FROM_BOT(ctx: IPhysics, bot: Bot, settings?: PhysicsWorldSettings): EPhysicsCtx<PlayerState>;
|
|
47
|
+
static FROM_ENTITY(ctx: IPhysics, entity: Entity, settings?: PhysicsWorldSettings): EPhysicsCtx<EntityState>;
|
|
48
|
+
static FROM_ENTITY_TYPE(ctx: IPhysics, entityType: md.Entity, options?: Partial<Entity>, settings?: PhysicsWorldSettings): EPhysicsCtx<EntityState>;
|
|
49
|
+
static FROM_ENTITY_STATE(ctx: IPhysics, entityState: IEntityState, entityType?: md.Entity, settings?: PhysicsWorldSettings): EPhysicsCtx<IEntityState>;
|
|
50
|
+
clone(): EPhysicsCtx<IEntityState>;
|
|
50
51
|
get height(): number;
|
|
51
52
|
get width(): number;
|
|
52
53
|
getHalfWidth(): number;
|
|
@@ -2,6 +2,7 @@ import type { Effect, Entity } from "prismarine-entity";
|
|
|
2
2
|
import type { Vec3 } from "vec3";
|
|
3
3
|
import { PlayerPoses } from "./poses";
|
|
4
4
|
import { ControlStateHandler } from "../states";
|
|
5
|
+
import { AABB } from "@nxg-org/mineflayer-util-plugin";
|
|
5
6
|
export * from "./entityState";
|
|
6
7
|
export * from "./playerState";
|
|
7
8
|
export * from "./poses";
|
|
@@ -44,5 +45,6 @@ export interface IEntityState {
|
|
|
44
45
|
jumpQueued: boolean;
|
|
45
46
|
supportingBlockPos: Vec3 | null;
|
|
46
47
|
clone(): IEntityState;
|
|
48
|
+
getBB(): AABB;
|
|
47
49
|
}
|
|
48
50
|
export declare function getPose(entity: Entity): number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControlStateHandler } from "../physics/player";
|
|
2
2
|
import { EPhysicsCtx } from "../physics/settings";
|
|
3
|
-
import { IEntityState } from "../physics/states";
|
|
3
|
+
import { EntityState, IEntityState } from "../physics/states";
|
|
4
4
|
import { IPhysics } from "../physics/engines";
|
|
5
5
|
import { Entity } from "prismarine-entity";
|
|
6
6
|
import { Vec3 } from "vec3";
|
|
@@ -10,8 +10,8 @@ export type Controller = (state: IEntityState, ticks: number) => void;
|
|
|
10
10
|
export declare class BaseSimulator {
|
|
11
11
|
readonly ctx: IPhysics;
|
|
12
12
|
constructor(ctx: IPhysics);
|
|
13
|
-
predictGenerator(simCtx: EPhysicsCtx, world: any, ticks?: number, controls?: ControlStateHandler): Generator<IEntityState, EPhysicsCtx
|
|
14
|
-
predictForward(target: Entity, world: any, ticks?: number, controls?: ControlStateHandler):
|
|
13
|
+
predictGenerator(simCtx: EPhysicsCtx, world: any, ticks?: number, controls?: ControlStateHandler): Generator<IEntityState, EPhysicsCtx<IEntityState>, unknown>;
|
|
14
|
+
predictForward(target: Entity, world: any, ticks?: number, controls?: ControlStateHandler): EntityState;
|
|
15
15
|
predictForwardRaw(simCtx: EPhysicsCtx, world: any, ticks?: number, controls?: ControlStateHandler): IEntityState;
|
|
16
16
|
simulateUntil(goal: SimulationGoal, onGoalReach: OnGoalReachFunction, controller: Controller, simCtx: EPhysicsCtx, world: any, ticks?: number): IEntityState;
|
|
17
17
|
static getReached(...path: Vec3[]): SimulationGoal;
|
package/dist/wrapper.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ export declare class PhysicsUtilWrapper {
|
|
|
19
19
|
readonly data: md.IndexedData;
|
|
20
20
|
constructor(bot: Bot);
|
|
21
21
|
getPhysicsSim(): EntityPhysics;
|
|
22
|
-
getPhysicsCtx(ctx: IPhysics, entity: Entity): EPhysicsCtx
|
|
23
|
-
getPhysicsCtxRaw(ctx: IPhysics, entity: md.Entity, options?: Partial<Entity>): EPhysicsCtx
|
|
22
|
+
getPhysicsCtx(ctx: IPhysics, entity: Entity): EPhysicsCtx<import(".").EntityState>;
|
|
23
|
+
getPhysicsCtxRaw(ctx: IPhysics, entity: md.Entity, options?: Partial<Entity>): EPhysicsCtx<import(".").EntityState>;
|
|
24
24
|
simulate(simulator: IPhysics, simCtx: EPhysicsCtx, world: any): import("./physics/states").IEntityState;
|
|
25
25
|
exampleSim(entity: Entity, type: SimulationTypes, ticks?: number, destination?: Vec3): import("./physics/states").IEntityState;
|
|
26
26
|
advancedExample(simCtx: EPhysicsCtx, type: SimulationTypes, ticks?: number, destination?: Vec3): import("./physics/states").IEntityState;
|