{"id":13565502,"url":"https://github.com/PrismarineJS/prismarine-viewer","last_synced_at":"2025-04-03T22:31:34.954Z","repository":{"id":36988775,"uuid":"271385423","full_name":"PrismarineJS/prismarine-viewer","owner":"PrismarineJS","description":"Web based viewer for servers and bots","archived":false,"fork":false,"pushed_at":"2024-03-17T16:34:19.000Z","size":312267,"stargazers_count":243,"open_issues_count":57,"forks_count":68,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-27T12:07:02.734Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://prismarinejs.github.io/prismarine-viewer/","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":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"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}},"created_at":"2020-06-10T21:05:49.000Z","updated_at":"2024-05-27T09:20:24.000Z","dependencies_parsed_at":"2023-12-15T17:02:54.564Z","dependency_job_id":"b708cf17-ab7c-40fb-a35d-9692038ca843","html_url":"https://github.com/PrismarineJS/prismarine-viewer","commit_stats":{"total_commits":298,"total_committers":22,"mean_commits":"13.545454545454545","dds":0.5570469798657718,"last_synced_commit":"b7624c36b908ab7bcd41e2d9af4e94c4dad1425e"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-viewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-viewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-viewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-viewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PrismarineJS","download_url":"https://codeload.github.com/PrismarineJS/prismarine-viewer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246679068,"owners_count":20816402,"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":[],"created_at":"2024-08-01T13:01:48.591Z","updated_at":"2025-04-03T22:31:34.948Z","avatar_url":"https://github.com/PrismarineJS.png","language":"JavaScript","funding_links":["https://issuehunt.io/r/PrismarineJS/prismarine-viewer"],"categories":["JavaScript","Development"],"sub_categories":["Bots Automation and Headless Clients"],"readme":"# prismarine-viewer\n\nWeb based viewer for servers and bots\n\n[![NPM version](https://img.shields.io/npm/v/prismarine-viewer.svg)](http://npmjs.com/package/prismarine-viewer)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/PrismarineJS/prismarine-viewer/ci.yml.svg?label=CI\u0026logo=github\u0026logoColor=lightgrey)](https://github.com/PrismarineJS/prismarine-viewer/actions?query=workflow%3A%22CI%22)\n[![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8)\n[![Gitter](https://img.shields.io/badge/chat-on%20gitter-brightgreen.svg)](https://gitter.im/PrismarineJS/general)\n[![Irc](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://irc.gitter.im/)\n[![Issue Hunt](https://github.com/BoostIO/issuehunt-materials/blob/master/v1/issuehunt-shield-v1.svg)](https://issuehunt.io/r/PrismarineJS/prismarine-viewer)\n\n[![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/PrismarineJS/prismarine-viewer)\n\n[\u003cimg src=\"https://prismarinejs.github.io/prismarine-viewer/test_1.18.1.png\" alt=\"viewer\" width=\"300\"\u003e](https://prismarinejs.github.io/prismarine-viewer/)\n\nSupports versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2, 1.14.4, 1.15.2, 1.16.1, 1.16.4, 1.17.1, 1.18.1, 1.19, 1.20.1, 1.21.1, 1.21.4.\n\n## Install\n\n```bash\nnpm install prismarine-viewer\n```\n\n## Example\n\n```js\nconst mineflayer = require('mineflayer')\nconst mineflayerViewer = require('prismarine-viewer').mineflayer\n\nconst bot = mineflayer.createBot({\n  username: 'Bot'\n})\n\nbot.once('spawn', () =\u003e {\n  mineflayerViewer(bot, { port: 3000 }) // Start the viewing server on port 3000\n\n  // Draw the path followed by the bot\n  const path = [bot.entity.position.clone()]\n  bot.on('move', () =\u003e {\n    if (path[path.length - 1].distanceTo(bot.entity.position) \u003e 1) {\n      path.push(bot.entity.position.clone())\n      bot.viewer.drawLine('path', path)\n    }\n  })\n})\n```\n\nMore examples:\n\n* First person bot [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/firstperson_bot.js)\n* Record view as video file [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/headless.js)\n* Streaming video to a python script [example](https://github.com/PrismarineJS/prismarine-viewer/tree/master/examples/python)\n* Visualize a world, without a bot [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/standalone.js)\n* Visualize the world coming from a proxy [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/proxy.js)\n* Click to move [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/clickmove.js)\n* Use the core api for viewing worlds [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/core)\n* Create an electron app with viewer [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/electron)\n* Create a fully front end viewer with an in memory world [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/standalone)\n* A minecraft web client example, using mineflayer and a websocket proxy [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/web_client)\n* Export parts of worlds as screenshot or 3d models [example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/exporter)\n\n## Projects using prismarine-viewer\n\n* [prismarine-web-client](https://gitlab.com/PrismarineJS/prismarine-web-client) A minecraft client in your browser\n\n\n## API\n\n### prismarine-viewer\n\n#### viewer\n\nThe core rendering library. It provides Viewer and WorldView which together make it possible to render a minecraft world.\nCheck its [API](viewer/README.md)\n\n#### mineflayer\n\nServe a webserver allowing to visualize the bot surrounding, in first or third person. Comes with drawing functionnalities.\n\n```js\nconst { mineflayer } = require('prismarine-viewer')\n```\n\nOptions:\n* `viewDistance` view radius, in chunks, default: `6`\n* `firstPerson` is the view first person ? default: `false`\n* `port` the port for the webserver, default: `3000`\n\n[example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/bot.js)\n\n#### standalone\n\nServe a webserver allowing to visualize a world.\n\n```js\nconst { standalone } = require('prismarine-viewer')\n```\n\nOptions:\n* `version` the version to use, default: `1.13.2`\n* `generator` a world generator function, default: `(x, y, z) =\u003e 0`\n* `center` a vec3 to center the view on, default: `new Vec3(0, 0, 0)`\n* `viewDistance` view radius, in chunks, default: `6`\n* `port` the port for the webserver, default: `3000`\n\n[example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/standalone.js)\n\n#### headless\n\nRender the bot view and stream it to a file or over TCP.\n\n```js\nconst { headless } = require('prismarine-viewer')\n```\n\nOptions:\n* `viewDistance` view radius, in chunks, default: `6`\n* `output` the output file or a `host:port` address to stream to, default: `output.mp4`\n* `frames` number of frames to record, `-1` for infinite, default: `200`\n* `width` the width of a frame, default: `512`\n* `height` the height of a frame, default: `512`\n\n[example](https://github.com/PrismarineJS/prismarine-viewer/blob/master/examples/headless.js)\n\n### Drawing (mineflayer mode)\n\nAll drawing function have a unique id that can be used to replace or erase the primitive.\n\n#### bot.viewer.drawLine (id, points, color=0xff0000)\n\nDraw a line passing through all the `points`.\n\n#### bot.viewer.erase (id)\n\nRemove the primitive with the given id from the display.\n\n#### bot.viewer.close ()\n\nStop the server and disconnect users.\n\n## Tests\n\n`npm run jestTest -- -t \"1.9.4\"`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPrismarineJS%2Fprismarine-viewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPrismarineJS%2Fprismarine-viewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPrismarineJS%2Fprismarine-viewer/lists"}