Files
node_server/bot/function/entity/attack_nearest_entity.ts
2026-10-22 17:07:08 +08:00

13 lines
675 B
TypeScript

import type {Bot} from '@wp2508/mineflayer';
import type {BaseFunction} from '../../../types/bot/function/function.ts';
import {entity_arguments, run_entity_operation, type NearestArgs} from './shared.ts';
export class init implements BaseFunction<NearestArgs> {
readonly name = 'attack_nearest_entity';
readonly i18n = {lang: 'zh-CN', name: '攻击最近实体', description: '攻击指定距离内名称匹配的最近实体,可选瞄准,不自动移动'};
readonly args = entity_arguments(true, false, true);
async run(bot: Bot, args: NearestArgs): Promise<boolean> {
return run_entity_operation(bot, args, true, 'attack', this.name);
}
}