开源软件名称(OpenSource Name):PrismarineJS/mineflayer开源软件地址(OpenSource Url):https://github.com/PrismarineJS/mineflayer开源编程语言(OpenSource Language):JavaScript 99.9%开源软件介绍(OpenSource Introduction):Mineflayer
Create Minecraft bots with a powerful, stable, and high level JavaScript API, also usable from Python. First time using Node.js? You may want to start with the tutorial. Know Python? Checkout some Python examples and try out Mineflayer on Google Colab. Features
RoadmapCheckout this page to see what our current projects are. InstallationFirst install Node.js >= 14 from nodejs.org then:
Documentation
ContributePlease read CONTRIBUTING.md and prismarine-contribute UsageVideos A tutorial video explaining the basic set up process for a bot can be found here. If you want to learn more, more video tutorials are there, and the corresponding source codes for those bots is there. Getting Started Without a version specified, the version of the server will be guessed automatically. Without auth specified, the mojang auth style will be guessed. Echo Exampleconst mineflayer = require('mineflayer')
const bot = mineflayer.createBot({
host: 'localhost', // minecraft server ip
username: 'email@example.com', // minecraft username
password: '12345678' // minecraft password, comment out if you want to log into online-mode=false servers
// port: 25565, // only set if you need a port that isn't 25565
// version: false, // only set if you need a specific version or snapshot (ie: "1.8.9" or "1.16.5"), otherwise it's set automatically
// auth: 'mojang' // only set if you need microsoft auth, then set this to 'microsoft'
})
bot.on('chat', (username, message) => {
if (username === bot.username) return
bot.chat(message)
})
// Log errors and kick reasons:
bot.on('kicked', console.log)
bot.on('error', console.log) See what your bot is doingThanks to the prismarine-viewer project, it's possible to display in a browser window what your bot is doing.
Just run const { mineflayer: mineflayerViewer } = require('prismarine-viewer')
bot.once('spawn', () => {
mineflayerViewer(bot, { port: 3007, firstPerson: true }) // port is the minecraft server port, if first person is false, you get a bird's-eye view
}) And you'll get a live view looking like this: More Examples
And many mores in the examples folder ModulesA lot of the active development is happening inside of small npm packages which are used by mineflayer. The Node Way™
ModulesThese are the main modules that make up mineflayer:
DebugYou can enable some protocol debugging output using DEBUG="minecraft-protocol" node [...] On windows :
Third Party PluginsMineflayer is pluggable; anyone can create a plugin that adds an even higher level API on top of Mineflayer. The most updated and useful are :
But also check out :
Projects Using Mineflayer
TestingTesting everythingSimply run: Testing specific versionRun Testing specific testRun Example
License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论