【问题标题】:Mineflayer-pathfinder goto coordinatesMineflayer-pathfinder goto 坐标
【发布时间】:2022-07-28 10:40:47
【问题描述】:

我想编程让我可以在 Minecraft 聊天中输入坐标,机器人会找到它们。但我不知道如何编程这样的东西?有人可以帮忙吗?

我是这个领域的新手,想测试一些简单的东西,但我做不到。

这是我尝试使用的代码,但它不起作用:

var mineflayer = require('mineflayer')
const { pathfinder, Movements, GoalBlock } = require('mineflayer-pathfinder')
const pathfinder = require('mineflayer-pathfinder').pathfinder
const Movements = require('mineflayer-pathfinder').Movements
const { GoalNear } = require('mineflayer-pathfinder').goals
const inventoryViewer = require('mineflayer-web-inventory')

var bot = mineflayer.createBot({
  host: "localhost",   
  username: "MLGPlayer9",
  version: "1.18.1"
})

inventoryViewer(bot)

bot.loadPlugin(pathfinder)

function greeting() {
  bot.chat("Mooooooin");
}

bot.once("spawn", greeting);
 
function goto() {
  bot.pathfinder.goto(1, 1, 1);
  
}

bot.once("spawn", goto);

【问题讨论】:

    标签: javascript minecraft path-finding mineflayer


    【解决方案1】:

    bot.pathfinder.setGoal(new GoalNear(1, 1, 1, 1)) 最后一个是距离有多近

    【讨论】:

      猜你喜欢
      • 2022-07-02
      • 2017-08-12
      • 1970-01-01
      • 2022-11-08
      • 1970-01-01
      • 2020-02-16
      • 1970-01-01
      • 1970-01-01
      • 2017-03-07
      相关资源
      最近更新 更多