【发布时间】: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