import { Bot } from 'mineflayer'; import { Entity } from 'prismarine-entity'; import { Vec3 } from 'vec3'; interface MineflayerBot extends Bot { getExplosionDamages(entity: Entity, position: Vec3, raidus: number, rawDamages?: boolean): number; } interface Options { /** * See https://github.com/PrismarineJS/mineflayer/issues/2030. */ ignoreInventoryCheck?: boolean; /** * If set to true it will automatically equip an end crystal. default is `true` */ autoEquip?: boolean; /** * Emits the `error` event when an error occurs internally. default is `false` */ logErrors?: boolean; /** * Logs information about what AutoCrystal is up to. default is `false` */ logDebug?: boolean; /** * If the damage exceeds the threshold, it will not place / break the crystal. default is `5` */ damageThreshold?: number; /** * The delay in ticks between each crystal placement. default is `1` */ delay?: number; /** * What the bot should prefer when choosing where to place a crystal. default is `none` */ priority?: 'none' | 'damage' | 'distance'; /** * The mode to use for placing the crystal. can be `suicide` or `safe` */ placeMode: 'suicide' | 'safe'; /** * The mode used for breaking the crystal. default is `safe` */ breakMode: 'suicide' | 'safe'; } export declare class AutoCrystal { bot: MineflayerBot; options: Options; private run; private started; private enabled; /** * Options for the `AutoCrystal` class. * @typedef {Object} Options * @property {boolean} [ignoreInventoryCheck=true] - See https://github.com/PrismarineJS/mineflayer/issues/2030. * @property {boolean} [autoEquip=true] - If set to true it will automatically equip an end crystal. * @property {boolean} [logDebug=false] - If the debug log should be emitted. * @property {boolean} [logErrors=false] - If errors should be logged. * @property {number} [damageThreshold=5] - If the damage exceeds the threshold, it will not place / break the crystal. * @property {string} [priority=distance] - What the bot should prefer when choosing where to place a crystal. * @property {number} [delay=1] - The delay in ticks between each crystal placement. * @property {string} placeMode - The mode to use for placing the crystal. can be `suicide` or `safe` * @property {string} breakMode - The mode to use for breaking the crystal. can be `suicide` or `safe` */ /** * @param {Options} options * @param {Bot} bot */ constructor(bot: MineflayerBot, options?: Options); /** * Emits the debug log event with the specified message. * @param {string} message The message to be emitted. * @param {Object} options The options for the debug method. * @returns {void} * @memberof AutoCrystal * @private */ private debug; /** * Shortcut for getting the damage for an entity. * @param {Entity} entity The entity to get the damage for. * @param {Vec3} position The position of the explosion. * @returns {number} The estimated damage the entity would recieve. * @memberof AutoCrystal * @private */ private getDamage; /** * Finds the best position to place the crystal on to. * @async * @param {Vec3} position Vec3 position. * @returns {Vec3} The position to place the crystal on. * @memberof AutoCrystal * @private */ private findPosition; /** * Places the crystal on the specified position. * @async * @param {Vec3} position Vec3 position. * @returns {boolean} A boolean indicating if the crystal was placed. * @memberof AutoCrystal * @private */ private placeCrystal; /** * Breaks the nearest crystal * @async * @param {Entity} entity The crystal to break. * @returns {boolean} A boolean indicating if the crystal was broken. * @memberof AutoCrystal * @private */ private breakCrystal; /** * Gets the nearest player * @async * @returns {Player} The nearest player entity object. * @returns {null} If no player is found. * @memberof AutoCrystal * @private */ private getNearestPlayer; /** * Gets holes near the bot. * @async * @returns {Vec3[]} An array of Vec3 positions * @memberof AutoCrystal */ getHoles(): Promise; /** * Starts the auto crystal * @async * @returns {Promise} * @memberof AutoCrystal * @private */ private start; /** * Stops the auto crystal * @async * @returns {Promise} * @memberof AutoCrystal * @private */ private stop; /** * Disables the AutoCrystal * @returns {boolean} * @memberof AutoCrystal */ disable(): boolean; /** * Enables the AutoCrystal * @returns {boolean} * @memberof AutoCrystal */ enable(): boolean; } export {};