forked from PrismarineJS/prismarine-web-client
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
3,204 additions
and
775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Minecraft Web Client | ||
|
||
A true Minecraft client running in your browser! A port of the original game to the web, written in JavaScript using modern web technologies. | ||
|
||
This project is a work in progress, but I consider it to be usable. If you encounter any bugs or usability issues, please report them! | ||
|
||
### Big Features | ||
|
||
- Connect to any offline server* (it's possible because of proxy servers, see below) | ||
- Open any zip world file or even folder in read-write mode! | ||
- Singleplayer mode with simple world generation | ||
- Works offline | ||
- Play with friends over global network! (P2P is powered by Peer.js servers) | ||
- First-class touch (mobile) & controller support | ||
- Resource pack support | ||
- even even more! | ||
|
||
There are a lot | ||
|
||
### World Loading | ||
|
||
Zip files and folders are supported. Just drag and drop them into the browser window. You can open folders in readonly and read-write mode. New chunks may be generated incorrectly for now. | ||
In case of opening zip files they are stored in your ram entirely, so there is a ~300mb file limit on IOS. | ||
Whatever offline mode you used (zip, folder, just single player), you can always export world with the `/export` command typed in the game chat. | ||
|
||
### Servers | ||
|
||
You can play almost on any server, supporting offline connections. | ||
See the [Mineflayer](https://github.com/PrismarineJS/mineflayer) repo for the list of supported versions (should support majority of versions). | ||
There is a builtin proxy, but you can also host a your one! Just clone the repo, run `pnpm i` (following CONTRIBUTING.MD) and run `pnpm prod-start`, then you can specify `http://localhost:8080` in the proxy field. | ||
MS account authentication will be supported soon. | ||
|
||
<!-- TODO proxy server communication graph --> | ||
|
||
### Things that are not planned yet | ||
|
||
- Mods, plugins (basically JARs) support, shaders - since they all are related to specific game pipelines | ||
|
||
### Advanced Settings | ||
|
||
There are many many settings, that are not exposed in the UI yet. You can find or change them by opening the browser console and typing `options`. You can also change them by typing `options.<setting_name> = <value>`. | ||
|
||
### Console | ||
|
||
To open the console, press `F12`, or if you are on mobile, you can type `#debug` in the URL (browser address bar), it wont't reload the page, but you will see a button to open the console. This way you can change advanced settings and see all errors or warnings. Also this way you can access global variables (described below). | ||
|
||
### Debugging | ||
|
||
It should be easy to build/start the project locally. See [CONTRIBUTING.MD](./CONTRIBUTING.md) for more info. | ||
|
||
However, there are many things that can be done in online version. You can access some global variables in the console and useful examples: | ||
|
||
- `localStorage.debug = '*'` - Enables all debug messages! | ||
|
||
- `bot` - Mineflayer bot instance. See Mineflayer documentation for more. | ||
- `viewer` - Three.js viewer instance, basically does all the rendering. | ||
- `viewer.world.sectionObjects` - Object with all active chunk sections (geometries) in the world. Each chunk section is a Three.js mesh or group. | ||
- `localServer` - Only for singleplayer mode/host. Flying Squid server instance, see it's documentation for more. | ||
- `localServer.overworld.storageProvider.regions` - See ALL LOADED region files with all raw data. | ||
|
||
- `nbt.simplify(someNbt)` - Simplifies nbt data, so it's easier to read. | ||
|
||
You can also drag and drop any .dat file into the browser window to see it's contents in the console. | ||
|
||
### F3 Keybindings | ||
|
||
- `F3` - Toggle debug overlay | ||
- `F3 + A` - Reload all chunks (these that are loaded from the server) | ||
<!-- <!-- - `F3 + N` - Restart local server (basically resets the world!) --> | ||
- `F3 + G` - Toggle chunk sections (geometries) border visibility (aka Three.js geometry helpers) - most probably need to reload chunks after toggling | ||
|
||
### Notable Things that Power this Project | ||
|
||
- [Mineflayer](https://github.com/PrismarineJS/mineflayer) - Handles all client-side communications with the server (including the builtin one) - forked | ||
- [Flying Squid](https://github.com/prismarineJS/flying-squid) - The builtin server that makes single player possible! Here forked version is used. | ||
- [Prismarine Provider Anvil](https://github.com/PrismarineJS/prismarine-provider-anvil) - Handles world loading (region format) | ||
- [Prismarine Physics](https://github.com/PrismarineJS/prismarine-physics) - Does all the physics calculations | ||
- [Minecraft Protocol](https://github.com/PrismarineJS/node-minecraft-protocol) - Makes connections to servers possible | ||
- [Peer.js](https://peerjs.com/) - P2P networking (when you open to wan) | ||
- [Three.js](https://threejs.org/) - Helping in 3D rendering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<div id="captured"></div> | ||
<script> | ||
const pointers = [] | ||
const up = () => { | ||
captured.textContent = pointers.join(', ') | ||
} | ||
window.addEventListener('pointerdown', (e) => { | ||
pointers.push(e.pointerId) | ||
document.body.setPointerCapture(e.pointerId) | ||
up() | ||
e.preventDefault() | ||
}) | ||
const remove = (id) => { | ||
pointers.splice(pointers.indexOf(id), 1) | ||
up() | ||
} | ||
window.addEventListener('pointerup', (e) => { | ||
pointers.push('up') | ||
remove(e.pointerId) | ||
}) | ||
window.addEventListener('pointercancel', (e) => { | ||
pointers.push('cancel') | ||
remove(e.pointerId) | ||
}) | ||
window.addEventListener('lostpointercapture', (e) => { | ||
pointers.push('lost') | ||
remove(e.pointerId) | ||
}) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.