UNPKG

@nxg-org/mineflayer-tracker

Version:

Provides functionality for more accurate entity and projectile tracking.

97 lines (96 loc) 3.54 kB
import { Vec3 } from "vec3"; import { AABB } from "@nxg-org/mineflayer-util-plugin"; import md from "minecraft-data"; import { Effect } from "prismarine-entity"; import { Block } from "prismarine-block"; import { NormalizedEnchant } from "prismarine-item"; import { makeSupportFeature } from "../extras/physicsUtils"; import { PlayerState } from "../states/playerState"; import { PhysicsSettings } from "../extras/physicsSettings"; import { EntityState } from "../states/entityState"; /** * 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 enum CheapEffects { SPEED = 0, JUMP_BOOST = 1, SLOWNESS = 2, DOLPHINS_GRACE = 3, SLOW_FALLING = 4, LEVITATION = 5 } export declare enum CheapEnchantments { DEPTH_STRIDER = 0 } export declare class Physics { data: md.IndexedData; 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; }; settings: PhysicsSettings; constructor(mcData: md.IndexedData); getPlayerBB(pos: { x: number; y: number; z: number; }): AABB; setPositionToBB(bb: AABB, pos: { x: number; y: number; z: number; }): void; getUnderlyingBlockBBs(queryBB: AABB, world: any): AABB[]; getSurroundingBBs(queryBB: AABB, world: any): AABB[]; adjustPositionHeight(pos: Vec3, world: any): void; moveEntity(entity: PlayerState | EntityState, dx: number, dy: number, dz: number, world: any): void; applyHeading(entity: PlayerState | EntityState, strafe: number, forward: number, multiplier: number): Vec3 | undefined; getEffectLevelCustom(wantedEffect: CheapEffects, effects: Effect[]): number; getEnchantmentLevelCustom(wantedEnchantment: CheapEnchantments, enchantments: any[]): any; getEffectLevel(effectName: string, effects: Effect[]): number; /** * Slightly modified since I cannot find the typing. */ getEnchantmentLevelTest(enchantmentName: string, enchantments: NormalizedEnchant[]): any; getEnchantmentLevel(enchantmentName: string, enchantments: any[]): any; isOnLadder(pos: { x: number; y: number; z: number; }, world: any): any; doesNotCollide(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: PlayerState | EntityState, strafe: number, forward: number, world: any): void; simulatePlayer(entity: PlayerState | EntityState, world: any): typeof entity; }