2021-02-27 17:12:11 -05:00
# prismarine-web-client
[](http://npmjs.com/package/prismarine-web-client)
[](https://github.com/PrismarineJS/prismarine-web-client/actions?query=workflow%3A%22CI%22)
2021-02-27 16:27:59 -05:00
[](https://discord.gg/GsEFRM8)
2021-02-27 17:12:11 -05:00
[](https://gitpod.io/#https://github.com/PrismarineJS/prismarine-web-client)
2021-02-27 16:27:59 -05:00
2021-03-12 10:59:51 -05:00
A Minecraft client running in a web page. **Live demo at https://webclient.prismarine.js.org/**
2021-03-02 15:25:43 -05:00
## How it Works
2021-03-05 19:29:28 -05:00
prismarine-web-client runs mineflayer and prismarine-viewer in the browser, which connects over WebSocket to a proxy
which translates the WebSocket connection into TCP to connect to normal Minecraft servers.
2021-02-27 16:27:59 -05:00
2021-02-28 21:45:27 -05:00
## Screenshot
2021-03-02 15:25:43 -05:00

## Live Demo
2021-03-12 10:59:51 -05:00
Click on this link to open it in your browser, no installation necessary: https://webclient.prismarine.js.org/
2021-02-28 21:45:27 -05:00
2021-03-02 15:25:43 -05:00
*Tested on Chrome & Firefox for desktop platforms.*
2021-02-27 17:35:59 -05:00
2021-03-05 19:29:28 -05:00
## Usage
To host it yourself, run these commands in bash:
2021-03-02 15:25:43 -05:00
```bash
$ npm install -g prismarine-web-client
$ prismarine-web-client
```
Finally, open `http://localhost:8080` in your browser.
2021-02-27 17:35:59 -05:00
2021-02-27 17:12:11 -05:00
## Features
2021-03-05 19:29:28 -05:00
* Display mobs and players
2021-03-02 15:25:43 -05:00
* Display blocks
* Movement (you can move, and you see entities moving live)
* Place and break blocks
2021-02-27 17:12:11 -05:00
## Roadmap
2021-03-02 15:25:43 -05:00
* Containers (inventory, chests, etc.)
* Sounds
* More World Interactions (attacking entities, etc.)
* Cosmetic Rendering Features (day night cycle, fog, etc.)
2021-02-27 16:27:59 -05:00
2021-02-27 17:35:59 -05:00
## Development
2021-02-27 17:12:11 -05:00
2021-03-02 15:25:43 -05:00
If you're contributing/making changes, you need to install it differently.
First, clone the repo.
Then, set your working directory to that of the repo. For example:
```bash
$ cd ~/prismarine-viewer/
```
Finally, run
```bash
$ npm install
2021-03-05 19:29:28 -05:00
$ npm start
2021-02-27 16:27:59 -05:00
```
2021-03-05 19:29:28 -05:00
This will start express and webpack in development mode: whenever you save a file, the build will be redone (it takes 5s),
and you can refresh the page to get the new result.
Connect to http://localhost:8080 in your browser.
You may want to disable auto saving in your IDE to avoid constant rebuilding, see https://webpack.js.org/guides/development/#adjusting-your-text-editor
2021-02-27 17:12:11 -05:00
2021-03-05 19:29:28 -05:00
To check the production build (take a minute to build), you can run `npm run build-start`
2021-02-27 16:27:59 -05:00
2021-03-05 19:29:28 -05:00
If you're interested in contributing, you can check projects at https://github.com/PrismarineJS/prismarine-web-client/projects
2021-02-27 16:27:59 -05:00
2021-03-12 19:14:17 -05:00
Some variables are exposed in window for debugging:
* bot
* viewer
* mcData
* worldView
* Vec3
* pathfinder