{"id":13408047,"url":"https://github.com/PrismarineJS/mineflayer","last_synced_at":"2025-03-14T12:31:57.156Z","repository":{"id":1338277,"uuid":"1284185","full_name":"PrismarineJS/mineflayer","owner":"PrismarineJS","description":"Create Minecraft bots with a powerful, stable, and high level JavaScript API.","archived":false,"fork":false,"pushed_at":"2024-10-27T20:59:06.000Z","size":12503,"stargazers_count":5033,"open_issues_count":331,"forks_count":912,"subscribers_count":88,"default_branch":"master","last_synced_at":"2024-10-29T17:34:03.287Z","etag":null,"topics":["bot","minecraft","minecraft-api","minecraft-bot","network","nodejs"],"latest_commit_sha":null,"homepage":"https://prismarinejs.github.io/mineflayer/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PrismarineJS.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"prismarinejs","custom":"https://rysolv.com/repos/detail/74691b23-938d-4b2f-b65a-5c47bf5b3f0f","github":"PrismarineJS"}},"created_at":"2011-01-23T09:41:55.000Z","updated_at":"2024-10-29T15:11:15.000Z","dependencies_parsed_at":"2024-01-11T20:44:55.174Z","dependency_job_id":"35c2f1df-2652-4906-9b66-a10a2ccb12a2","html_url":"https://github.com/PrismarineJS/mineflayer","commit_stats":{"total_commits":2521,"total_committers":237,"mean_commits":"10.637130801687764","dds":0.775089250297501,"last_synced_commit":"3d6e2344751c38428701dc52e9f29dda73f7f782"},"previous_names":[],"tags_count":179,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fmineflayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fmineflayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fmineflayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fmineflayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PrismarineJS","download_url":"https://codeload.github.com/PrismarineJS/mineflayer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243578380,"owners_count":20313820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","minecraft","minecraft-api","minecraft-bot","network","nodejs"],"created_at":"2024-07-30T20:00:50.384Z","updated_at":"2025-03-14T12:31:57.127Z","avatar_url":"https://github.com/PrismarineJS.png","language":"JavaScript","funding_links":["https://opencollective.com/prismarinejs","https://rysolv.com/repos/detail/74691b23-938d-4b2f-b65a-5c47bf5b3f0f","https://github.com/sponsors/PrismarineJS"],"categories":["JavaScript","Tools","Utilities","游戏","Gaming \u0026 Entertainment MCP Servers"],"sub_categories":["Other Libraries","资源传输下载"],"readme":"# Mineflayer\n\n[![NPM version](https://img.shields.io/npm/v/mineflayer.svg?color=success\u0026label=npm%20package\u0026logo=npm)](https://www.npmjs.com/package/mineflayer)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/PrismarineJS/mineflayer/ci.yml.svg?label=CI\u0026logo=github\u0026logoColor=lightgrey)](https://github.com/PrismarineJS/mineflayer/actions?query=workflow%3A%22CI%22)\n[![Try it on gitpod](https://img.shields.io/static/v1.svg?label=try\u0026message=on%20gitpod\u0026color=brightgreen\u0026logo=gitpod)](https://gitpod.io/#https://github.com/PrismarineJS/mineflayer)\n[![Open In Colab](https://img.shields.io/static/v1.svg?label=open\u0026message=on%20colab\u0026color=blue\u0026logo=google-colab)](https://colab.research.google.com/github/PrismarineJS/mineflayer/blob/master/docs/mineflayer.ipynb)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/PrismarineJS)](https://github.com/sponsors/PrismarineJS)\n\n[![Official Discord](https://img.shields.io/static/v1.svg?label=OFFICIAL\u0026message=DISCORD\u0026color=blue\u0026logo=discord\u0026style=for-the-badge)](https://discord.gg/GsEFRM8)\n\n| \u003csub\u003eEN\u003c/sub\u003e [English](README.md) | \u003csub\u003eRU\u003c/sub\u003e [русский](ru/README_RU.md) | \u003csub\u003eES\u003c/sub\u003e [Español](es/README_ES.md) | \u003csub\u003eFR\u003c/sub\u003e [Français](fr/README_FR.md) | \u003csub\u003eTR\u003c/sub\u003e [Türkçe](tr/README_TR.md) | \u003csub\u003eZH\u003c/sub\u003e [中文](zh/README_ZH_CN.md) | \u003csub\u003eBR\u003c/sub\u003e [Português](br/README_BR.md) |\n|-------------------------|----------------------------|----------------------------|----------------------------|----------------------------|-------------------------|--------------------|\n\nCreate Minecraft bots with a powerful, stable, and high level JavaScript [API](api.md), also usable from Python.\n\nFirst time using Node.js? You may want to start with the [tutorial](tutorial.md). Know Python? Checkout some [Python examples](https://github.com/PrismarineJS/mineflayer/tree/master/examples/python) and try out [Mineflayer on Google Colab](https://colab.research.google.com/github/PrismarineJS/mineflayer/blob/master/docs/mineflayer.ipynb).\n\n## Features\n\n * Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, and 1.21)\n * Entity knowledge and tracking.\n * Block knowledge. You can query the world around you. Milliseconds to find any block.\n * Physics and movement - handle all bounding boxes\n * Attacking entities and using vehicles.\n * Inventory management.\n * Crafting, chests, dispensers, enchantment tables.\n * Digging and building.\n * Miscellaneous stuff such as knowing your health and whether it is raining.\n * Activating blocks and using items.\n * Chat.\n\n### Roadmap\n\n Checkout [this page](https://github.com/PrismarineJS/mineflayer/wiki/Big-Prismarine-projects) to see what our current projects are.\n\n## Installation\n\nFirst install Node.js \u003e= 18 from [nodejs.org](https://nodejs.org/) then:\n\n```bash\nnpm install mineflayer\n```\n\nTo update mineflayer (or any Node.js) package and its dependencies, use \n```bash\nnpm update\n```\n\n## Documentation\n\n| link | description |\n|---|---|\n|[tutorial](tutorial.md) | Begin with Node.js and mineflayer |\n| [FAQ.md](FAQ.md) | Got a question ? go there first |\n| **[api.md](api.md)** \u003cbr/\u003e[unstable_api.md](unstable_api.md) | The full API reference |\n| [history.md](history.md) | The changelog for mineflayer |\n| [examples/](https://github.com/PrismarineJS/mineflayer/tree/master/examples) | Checkout all the mineflayer examples |\n\n\n## Contribute\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) and [prismarine-contribute](https://github.com/PrismarineJS/prismarine-contribute)\n\n## Usage\n\n**Videos**\n\nA tutorial video explaining the basic set up process for a bot can be found [here.](https://www.youtube.com/watch?v=ltWosy4Z0Kw)\n\nIf you want to learn more, more video tutorials are [there,](https://www.youtube.com/playlist?list=PLh_alXmxHmzGy3FKbo95AkPp5D8849PEV) and the corresponding source codes for those bots is [there.](https://github.com/TheDudeFromCI/Mineflayer-Youtube-Tutorials)\n\n[\u003cimg src=\"https://img.youtube.com/vi/ltWosy4Z0Kw/0.jpg\" alt=\"tutorial 1\" width=\"200\"\u003e](https://www.youtube.com/watch?v=ltWosy4Z0Kw)\n[\u003cimg src=\"https://img.youtube.com/vi/UWGSf08wQSc/0.jpg\" alt=\"tutorial 2\" width=\"200\"\u003e](https://www.youtube.com/watch?v=UWGSf08wQSc)\n[\u003cimg src=\"https://img.youtube.com/vi/ssWE0kXDGJE/0.jpg\" alt=\"tutorial 3\" width=\"200\"\u003e](https://www.youtube.com/watch?v=ssWE0kXDGJE)\n[\u003cimg src=\"https://img.youtube.com/vi/walbRk20KYU/0.jpg\" alt=\"tutorial 4\" width=\"200\"\u003e](https://www.youtube.com/watch?v=walbRk20KYU)\n\n**Getting Started**\n\nWithout a version specified, the version of the server will be guessed automatically.\nWithout auth specified, the mojang auth style will be guessed.\n\n### Echo Example\n```js\nconst mineflayer = require('mineflayer')\n\nconst bot = mineflayer.createBot({\n  host: 'localhost', // minecraft server ip\n  username: 'Bot', // username to join as if auth is `offline`, else a unique identifier for this account. Switch if you want to change accounts\n  auth: 'microsoft' // for offline mode servers, you can set this to 'offline'\n  // port: 25565,              // set if you need a port that isn't 25565\n  // 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\n  // password: '12345678'      // set if you want to use password-based auth (may be unreliable). If specified, the `username` must be an email\n})\n\nbot.on('chat', (username, message) =\u003e {\n  if (username === bot.username) return\n  bot.chat(message)\n})\n\n// Log errors and kick reasons:\nbot.on('kicked', console.log)\nbot.on('error', console.log)\n```\n\nIf `auth` is set to `microsoft`, you will be prompted to login to microsoft.com with a code in your browser. After signing in on your browser, \nthe bot will automatically obtain and cache authentication tokens (under your specified username) so you don't have to sign-in again. \n\nTo switch the account, update the supplied `username`. By default, cached tokens will be stored in your user's .minecraft folder, or if `profilesFolder` is specified, they'll instead be stored there.\nFor more information on bot options see node-minecraft-protocol's [API doc](https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/docs/API.md#mccreateclientoptions).\n\n#### Connecting to a Realm\n\nTo join a Realm that your Minecraft account has been invited to, you can pass a `realms` object with a selector function like below.\n\n```js\nconst client = mineflayer.createBot({\n  username: 'email@example.com', // minecraft username\n  realms: {\n    // This function is called with an array of Realms the account can join. It should return the one it wants to join.\n    pickRealm: (realms) =\u003e realms[0]\n  },\n  auth: 'microsoft'\n})\n```\n\n### See what your bot is doing\n\nThanks to the [prismarine-viewer](https://github.com/PrismarineJS/prismarine-viewer) project, it's possible to display in a browser window what your bot is doing.\nJust run `npm install prismarine-viewer` and add this to your bot:\n```js\nconst { mineflayer: mineflayerViewer } = require('prismarine-viewer')\nbot.once('spawn', () =\u003e {\n  mineflayerViewer(bot, { port: 3007, firstPerson: true }) // port is the minecraft server port, if first person is false, you get a bird's-eye view\n})\n```\nAnd you'll get a *live* view looking like this:\n\n[\u003cimg src=\"https://prismarinejs.github.io/prismarine-viewer/test_1.16.1.png\" alt=\"viewer\" width=\"500\"\u003e](https://prismarinejs.github.io/prismarine-viewer/)\n\n#### More Examples\n\n| example | description |\n|---|---|\n|[viewer](https://github.com/PrismarineJS/mineflayer/tree/master/examples/viewer) | Display your bot world view in the browser |\n|[pathfinder](https://github.com/PrismarineJS/mineflayer/tree/master/examples/pathfinder) | Make your bot go to any location automatically |\n|[chest](https://github.com/PrismarineJS/mineflayer/blob/master/examples/chest.js) | Use chests, furnaces, dispensers, enchantment tables |\n|[digger](https://github.com/PrismarineJS/mineflayer/blob/master/examples/digger.js) | Learn how to create a simple bot that is capable of digging blocks |\n|[discord](https://github.com/PrismarineJS/mineflayer/blob/master/examples/discord.js) | Connect a discord bot with a mineflayer bot |\n|[jumper](https://github.com/PrismarineJS/mineflayer/blob/master/examples/jumper.js) | Learn how to move, jump, ride vehicles, attack nearby entities |\n|[ansi](https://github.com/PrismarineJS/mineflayer/blob/master/examples/ansi.js) | Display your bot's chat with all of the chat colors shown in your terminal |\n|[guard](https://github.com/PrismarineJS/mineflayer/blob/master/examples/guard.js) | Make a bot guard a defined area from nearby mobs |\n|[multiple-from-file](https://github.com/PrismarineJS/mineflayer/blob/master/examples/multiple_from_file.js) | Add a text file with accounts and have them all login |\n\nAnd many more in the [examples](https://github.com/PrismarineJS/mineflayer/tree/master/examples) folder.\n\n### Modules\n\nA lot of the active development is happening inside of small npm packages which are used by mineflayer.\n\n#### The Node Way\u0026trade;\n\n\u003e \"When applications are done well, they are just the really application-specific, brackish residue that can't be so easily abstracted away. All the nice, reusable components sublimate away onto github and npm where everybody can collaborate to advance the commons.\" — substack from [\"how I write modules\"](https://gist.github.com/substack/5075355)\n\n#### Modules\n\nThese are the main modules that make up mineflayer:\n\n| module | description |\n|---|---|\n| [minecraft-protocol](https://github.com/PrismarineJS/node-minecraft-protocol) | Parse and serialize minecraft packets, plus authentication and encryption.\n| [minecraft-data](https://github.com/PrismarineJS/minecraft-data) | Language independent module providing minecraft data for minecraft clients, servers and libraries.\n| [prismarine-physics](https://github.com/PrismarineJS/prismarine-physics) | Provide the physics engine for minecraft entities\n| [prismarine-chunk](https://github.com/PrismarineJS/prismarine-chunk) | A class to hold chunk data for Minecraft\n| [node-vec3](https://github.com/PrismarineJS/node-vec3) | 3d vector math with robust unit tests\n| [prismarine-block](https://github.com/PrismarineJS/prismarine-block) | Represent a minecraft block with its associated data\n| [prismarine-chat](https://github.com/PrismarineJS/prismarine-chat) | A parser for a minecraft chat message (extracted from mineflayer)\n| [node-yggdrasil](https://github.com/PrismarineJS/node-yggdrasil) | Node.js library to interact with Mojang's authentication system, known as Yggdrasil\n| [prismarine-world](https://github.com/PrismarineJS/prismarine-world) | The core implementation of worlds for prismarine\n| [prismarine-windows](https://github.com/PrismarineJS/prismarine-windows) | Represent minecraft windows\n| [prismarine-item](https://github.com/PrismarineJS/prismarine-item) | Represent a minecraft item with its associated data\n| [prismarine-nbt](https://github.com/PrismarineJS/prismarine-nbt) | An NBT parser for node-minecraft-protocol\n| [prismarine-recipe](https://github.com/PrismarineJS/prismarine-recipe) | Represent minecraft recipes\n| [prismarine-biome](https://github.com/PrismarineJS/prismarine-biome) | Represent a minecraft biome with its associated data\n| [prismarine-entity](https://github.com/PrismarineJS/prismarine-entity) | Represent a minecraft entity\n\n\n### Debug\n\nYou can enable some protocol debugging output using `DEBUG` environment variable:\n\n```bash\nDEBUG=\"minecraft-protocol\" node [...]\n```\n\nOn windows :\n```\nset DEBUG=minecraft-protocol\nnode your_script.js\n```\n\n## Third Party Plugins\n\nMineflayer is pluggable; anyone can create a plugin that adds an even\nhigher level API on top of Mineflayer.\n\nThe most updated and useful are :\n\n * [pathfinder](https://github.com/Karang/mineflayer-pathfinder) - advanced A* pathfinding with a lot of configurable features\n * [prismarine-viewer](https://github.com/PrismarineJS/prismarine-viewer) - simple web chunk viewer\n * [web-inventory](https://github.com/ImHarvol/mineflayer-web-inventory) - web based inventory viewer\n * [statemachine](https://github.com/PrismarineJS/mineflayer-statemachine) - A state machine API for more complex bot behaviors\n * [Armor Manager](https://github.com/G07cha/MineflayerArmorManager) - automatic armor management\n * [Dashboard](https://github.com/wvffle/mineflayer-dashboard) - Frontend dashboard for mineflayer bot\n * [PVP](https://github.com/PrismarineJS/mineflayer-pvp) - Easy API for basic PVP and PVE.\n * [Auto Eat](https://github.com/link-discord/mineflayer-auto-eat) - Automatic eating of food.\n * [Auto Crystal](https://github.com/link-discord/mineflayer-autocrystal) - Automatic placing \u0026 breaking of end crystals.\n * [Tool](https://github.com/TheDudeFromCI/mineflayer-tool) - A utility for automatic tool/weapon selection with a high level API.\n * [Hawkeye](https://github.com/sefirosweb/minecraftHawkEye) - A utility for using auto-aim with bows.\n * [GUI](https://github.com/firejoust/mineflayer-GUI) - Interact with nested GUI windows using async/await\n * [Projectile](https://github.com/firejoust/mineflayer-projectile) - Get the required launch angle for projectiles\n * [Movement](https://github.com/firejoust/mineflayer-movement) - Smooth and realistic player movement, best suited for PvP\n * [Collect Block](https://github.com/PrismarineJS/mineflayer-collectblock) - Quick and simple block collection API.\n\n But also check out :\n\n * [radar](https://github.com/andrewrk/mineflayer-radar/) - web based radar\n   interface using canvas and socket.io. [YouTube Demo](https://www.youtube.com/watch?v=FjDmAfcVulQ)\n * [auto-auth](https://github.com/G07cha/MineflayerAutoAuth) - chat-based bot authentication\n * [Bloodhound](https://github.com/Nixes/mineflayer-bloodhound) - determine who and what is responsible for damage to another entity\n * [tps](https://github.com/SiebeDW/mineflayer-tps) - get the current tps (processed tps)\n * [panorama](https://github.com/IceTank/mineflayer-panorama) - take Panorama Images of your world\n * [player-death-event](https://github.com/tuanzisama/mineflayer-death-event) - emit player death event in Mineflayer.\n\n## Projects Using Mineflayer\n\n * [Voyager](https://github.com/MineDojo/Voyager) An Open-Ended Embodied Agent with Large Language Models\n * [mindcraft](https://github.com/kolbytn/mindcraft) Lib for using mineflayer with LLMs\n * [rom1504/rbot](https://github.com/rom1504/rbot)\n   - [YouTube - building a spiral staircase](https://www.youtube.com/watch?v=UM1ZV5200S0)\n   - [YouTube - replicating a building](https://www.youtube.com/watch?v=0cQxg9uDnzA)\n * [Darthfett/Helperbot](https://github.com/Darthfett/Helperbot)\n * [vogonistic/voxel](https://github.com/vogonistic/mineflayer-voxel) - visualize what\n   the bot is up to using voxel.js\n * [JonnyD/Skynet](https://github.com/JonnyD/Skynet) -  log player activity onto an online API\n * [MinecraftChat](https://github.com/rom1504/MinecraftChat) (last open source version, built by AlexKvazos) -  Minecraft web based chat client\n * [Cheese Bot](https://github.com/Minecheesecraft/Cheese-Bot) - Plugin based bot with a clean GUI. Made with Node-Webkit.\n * [Chaoscraft](https://github.com/schematical/chaoscraft) - Minecraft bot using genetic algorithms, see [its youtube videos](https://www.youtube.com/playlist?list=PLLkpLgU9B5xJ7Qy4kOyBJl5J6zsDIMceH)\n * [hexatester/minetelegram](https://github.com/hexatester/minetelegram) -  Minecraft - Telegram bridge, build on top of mineflayer \u0026 telegraf.\n * [PrismarineJS/mineflayer-builder](https://github.com/PrismarineJS/mineflayer-builder) - Prints minecraft schematics in survival, keeping orientation\n * [SilkePilon/OpenDeliveryBot](https://github.com/SilkePilon/OpenDeliveryBot) - Minecraft bot in python to deliver items from place to place.\n * [and hundreds more](https://github.com/PrismarineJS/mineflayer/network/dependents) - All the projects that github detected are using mineflayer\n\n\n## Testing\n\n### Testing everything\n\nSimply run: \n\n```bash\nnpm test\n```\n\n### Testing specific version\nRun \n\n```bash\nnpm run mocha_test -- -g \u003cversion\u003e\n```\n\nwhere `\u003cversion\u003e` is a minecraft version like `1.12`, `1.15.2`...\n\n### Testing specific test\nRun \n\n```bash\nnpm run mocha_test -- -g \u003ctest_name\u003e\n```\n\nwhere `\u003ctest_name\u003e` is a name of the test like `bed`, `useChests`, `rayTrace`...\n\n### Example\n\n```bash\nnpm run mocha_test -- -g \"1.18.1.*BlockFinder\"\n```\nto run the block finder test for 1.18.1\n\n## License\n\n[MIT](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPrismarineJS%2Fmineflayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPrismarineJS%2Fmineflayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPrismarineJS%2Fmineflayer/lists"}