跳到主要内容

Baritone API

信息

需要安装 Baritone 模组。全局对象为 baritone / br。

寻路​

br.goto(x, y, z) // walk to coordinates
br.goal(x, y, z) // set goal (use path() to start)
br.path() // start pathing to current goal
br.come() // come to your camera position
br.surface() // return to surface
br.axis() // go to nearest axis (X=0 or Z=0)
br.thisWay() // go in facing direction

挖掘与开凿​

br.mine('diamond_ore', 64) // automated mining with count
br.mine('coal_ore') // unlimited mining
br.tunnel() // dig a 1×2 tunnel

耕作与探索​

br.farm(100) // auto-harvest crops, range=100
br.explore() // explore new chunks
br.getToBlock('minecraft:chest') // walk to nearest chest

跟随与物品​

br.follow('minecraft:pig') // follow entity type
br.follow() // follow any player
br.pickup() // collect nearby drops

建造​

br.build('house.schematic') // build from schematics file
br.build('house.schematic', 0, 64, 0) // with origin
br.litematica() // build current Litematica schematic

控制​

br.stop() // cancel everything
br.cancel() // same as stop()
br.forceCancel() // force cancel
br.pause() // pause current task
br.resume() // resume paused task
br.isActive() // → boolean (is pathing?)
br.isPaused() // → boolean
br.paused() // → boolean (alias)

选区​

br.selPos1() // set pos1 to current position
br.selPos1(x, y, z) // set pos1 to coordinates
br.selPos2() // set pos2 to current position
br.selPos2(x, y, z) // set pos2 to coordinates
br.select(x1,y1,z1, x2,y2,z2) // set 3D selection
br.clearSelection() // clear all selections

设置与命令​

br.setting('allowBreak', true) // toggle baritone setting
br.command('mine diamond_ore 64') // run raw baritone command

路径点与家​

br.waypointSave('farm') // save current position
br.waypointList() // list all waypoints
br.waypointDelete('farm') // delete waypoint
br.sethome() // set home position
br.home() // pathfind to home

信息与工具​

br.find('diamond_ore') // search world cache
br.blacklist() // blacklist crosshair block
br.proc() // show current process info
br.eta() // estimated time to arrival
br.version() // baritone version
br.repack() // re-cache chunks
br.gc() // release memory
br.invert() // invert goal (go away from target)
br.render() // fix chunk rendering
br.reloadAll() // reload world cache
br.saveAll() // save world cache
br.elytra() // elytra flight mode

提示: 拿不准时,优先使用 br.* 而不是手动移动。Baritone 处理寻路、避障和挖掘的效率远高于脚本调用 mc.forward()。