@nxg-org/mineflayer-physics-util
Version:
Provides functionality for more accurate entity and projectile tracking.
80 lines (79 loc) • 3.04 kB
TypeScript
import { AABB } from "@nxg-org/mineflayer-util-plugin";
import md from "minecraft-data";
import { Block } from "prismarine-block";
import { Effect } from "prismarine-entity";
import { Vec3 } from "vec3";
import { CheapEffects, CheapEnchantments, makeSupportFeature } from "../../util/physicsUtils";
import { EPhysicsCtx } from "../settings/entityPhysicsCtx";
import { IPhysics } from "./IPhysics";
import { IEntityState } from "../states";
/**
* Looking at this code, it's too specified towards players.
*
* I will eventually split this code into PlayerState and bot.entityState, where bot.entityState contains fewer controls.
*/
export declare class EntityPhysics implements IPhysics {
data: md.IndexedData;
movementSpeedAttribute: any;
supportFeature: ReturnType<typeof makeSupportFeature>;
blockSlipperiness: {
[name: string]: number;
};
protected slimeBlockId: number;
protected soulsandId: number;
protected honeyblockId: number;
protected webId: number;
protected waterId: number;
protected lavaId: number;
protected ladderId: number;
protected vineId: number;
protected bubblecolumnId: number;
protected waterLike: Set<number>;
readonly statusEffectNames: {
[type in CheapEffects]: string;
};
readonly enchantmentNames: {
[type in CheapEnchantments]: string;
};
constructor(mcData: md.IndexedData);
getEntityBB(entity: EPhysicsCtx, pos: {
x: number;
y: number;
z: number;
}): AABB;
setPositionToBB(entity: EPhysicsCtx, bb: AABB, pos: {
x: number;
y: number;
z: number;
}): void;
shouldMoveEntity(entity: EPhysicsCtx): boolean;
getUnderlyingBlockBBs(queryBB: AABB, world: any): AABB[];
getSurroundingBBs(queryBB: AABB, world: any): AABB[];
adjustPositionHeight(entity: EPhysicsCtx, pos: Vec3, world: any): void;
moveEntity(entity: EPhysicsCtx, dx: number, dy: number, dz: number, world: any): void;
applyHeading(entity: EPhysicsCtx, strafe: number, forward: number, multiplier: number): void;
getEffectLevel(wantedEffect: CheapEffects, effects: Effect[]): number;
getEnchantmentLevel(wantedEnchantment: CheapEnchantments, enchantments: any[]): any;
isOnLadder(pos: {
x: number;
y: number;
z: number;
}, world: any): any;
doesNotCollide(entity: EPhysicsCtx, pos: {
x: number;
y: number;
z: number;
}, world: any): boolean;
isMaterialInBB(queryBB: AABB, type: number, world: any): boolean;
getWaterInBB(bb: AABB, world: any): any[];
getLiquidHeightPcent(block: Block): number;
getRenderedDepth(block: Block): number;
getFlow(block: Block, world: any): Vec3;
isInWaterApplyCurrent(bb: AABB, vel: {
x: number;
y: number;
z: number;
}, world: any): boolean;
moveEntityWithHeading(entity: EPhysicsCtx, strafe: number, forward: number, world: any): void;
simulate(entity: EPhysicsCtx, world: any): IEntityState;
}