UNPKG

@nxg-org/mineflayer-util-plugin

Version:

mineflayer utils for NextGEN mineflayer plugins.

43 lines (42 loc) 1.45 kB
import type { Bot } from "mineflayer"; import type { Block } from "prismarine-block"; import { Vec3 } from "vec3"; import AABB from "../calcs/aabb"; export type Overwrites = { [coord: string]: Block | null; }; /** * A class dedicated to predictive logic. * * Currently, this class can predict explosion damages of crystals using a custom world. */ export declare class PredictiveWorld { private blocks; private originalWorld; constructor(bot: Bot); raycast(from: Vec3, direction: Vec3, range: number, matcher?: ((block: Block) => boolean) | null): Block | null; /** * this works * @param {Block} block */ setBlock(pos: Vec3, block: Block): void; /** * @param {Overwrites} blocks Blocks indexed by position.toString() */ setBlocks(blocks: Overwrites): void; /** * @param {Vec3} pos * @returns {Block | null} Block at position. */ getBlock(pos: Vec3): Block | null; removeBlock(pos: Vec3, force: boolean): void; removeBlocks(positions: Vec3[], force: boolean): void; /** * @param playerPos Position of effected entity. * @param explosionPos Position of explosion origin. * @param block bot.block * @returns List of affected blocks that potentially protect the entity. */ getExplosionAffectedBlocks(entityBB: AABB, explosionPos: Vec3): Overwrites; loadProtectiveBlocks(playerPos: Vec3, explosionPos: Vec3): void; }