1 Star 1 Fork 0

Xingyuan55/mcChater

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
pvp.js 836 Bytes
一键复制 编辑 原始数据 按行查看 历史
Xingyuan55 提交于 2023-02-13 14:54 . Build 1000 @ chater1
const mineflayer = require('mineflayer')
const { pathfinder, Movements, goals } = require('mineflayer-pathfinder')
const pvp = require('mineflayer-pvp').plugin
const bot = mineflayer.createBot({
host: "mc.icraft.cc",
username: "_chater",
port: 49282,
version: "1.16.5",
})
bot.loadPlugin(pathfinder)
bot.loadPlugin(pvp)
bot.on('chat', (username, message) => {
if (message === 'fight me') {
const player = bot.players[username]
if (!player) {
bot.chat("I can't see you.")
return
}
bot.pvp.attack(player.entity)
}
if (message === 'stop') {
bot.pvp.stop()
}
})
function chat_to_game(msg)
{
bot.once('spawn', () => { chater.chat(msg) })
}
bot.on('message', (message) => {
console.log(message.toAnsi())
})
bot.on("login", (login) =>{
chat_to_game("/l tt5566tt")
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/XingYuan55/mcChater.git
git@gitee.com:XingYuan55/mcChater.git
XingYuan55
mcChater
mcChater
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385