diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index f3722d3a..1db1bb9e 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -27,6 +27,7 @@ jobs: run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - name: Build Project Artifacts run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - run: pnpm build-storybook - name: Copy playground files run: node prismarine-viewer/esbuild.mjs && cp prismarine-viewer/public/index.html .vercel/output/static/playground.html && cp prismarine-viewer/public/playground.js .vercel/output/static/playground.js - name: Download Generated Sounds map diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 407fd03f..22958d3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,9 @@ After forking the repository, run the following commands to get started: A few notes: +- Use `next` branch for development and as base & target branch for pull requests if possible. +- To link dependency locally e.g. flying-squid add this to `pnpm` > `overrides` of root package.json: `"flying-squid": "file:../space-squid",` (with some modules `pnpm link` also works) + - It's recommended to use debugger for debugging. VSCode has a great debugger built-in. If debugger is slow, you can use `--no-sources` flag that would allow browser to speedup .map file parsing. - Some data are cached between restarts. If you see something doesn't work after upgrading dependencies, try to clear the by simply removing the `dist` folder. - The same folder `dist` is used for both development and production builds, so be careful when deploying the project. diff --git a/README.MD b/README.MD index 36d20865..d4c3c6e8 100644 --- a/README.MD +++ b/README.MD @@ -6,7 +6,7 @@ A true Minecraft client running in your browser! A port of the original game to 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! -You can try this out at [mcraft.fun](https://mcraft.fun/), [mcon.vercel.app](https://mcon.vercel.app/) or the GitHub pages deploy. +You can try this out at [mcraft.fun](https://mcraft.fun/), [pcm.gg](https://pcm.gg) (short link) [mcon.vercel.app](https://mcon.vercel.app/) or the GitHub pages deploy. Every commit from the `develop` (default) branch is deployed to [s.mcraft.fun](https://s.mcraft.fun/) - so it's usually newer, but might be less stable. ### Big Features @@ -83,6 +83,20 @@ You can also drag and drop any .dat or .mca (region files) into the browser wind world chunks have a *yellow* border, hostile mobs have a *red* outline, passive mobs have a *green* outline, players have a *blue* outline. +### Query Parameters + +Press `Y` to set query parameters to url of your current game state. + +- `?server=` - Display connect screen to the server on load +- `?username=` - Set the username on load +- `?proxy=` - Set the proxy server address on load +- `?version=` - Set the version on load +- `?reconnect=true` - Reconnect to the server on page reloads. Available in **dev mode only** and very useful on server testing. + +- `?loadSave=` - Load the save on load with the specified folder name (not title) +- `?singleplayer=1` - Create empty world on load. Nothing will be saved +- `?noSave=true` - Disable auto save on unload / disconnect / export. Only manual save with `/save` command will work + ### 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 diff --git a/assets/generic_91.png b/assets/generic_91.png new file mode 100644 index 00000000..99e4d04a Binary files /dev/null and b/assets/generic_91.png differ diff --git a/assets/generic_92.png b/assets/generic_92.png new file mode 100644 index 00000000..299e081b Binary files /dev/null and b/assets/generic_92.png differ diff --git a/assets/generic_93.png b/assets/generic_93.png new file mode 100644 index 00000000..1b35f671 Binary files /dev/null and b/assets/generic_93.png differ diff --git a/assets/generic_94.png b/assets/generic_94.png new file mode 100644 index 00000000..19dc788d Binary files /dev/null and b/assets/generic_94.png differ diff --git a/assets/generic_95.png b/assets/generic_95.png new file mode 100644 index 00000000..2286dbfc Binary files /dev/null and b/assets/generic_95.png differ diff --git a/config.json b/config.json index 7c0ce254..81572913 100644 --- a/config.json +++ b/config.json @@ -3,5 +3,5 @@ "defaultHost": "", "defaultProxy": "zardoy.site:2344", "defaultVersion": "1.18.2", - "mapsProvider": "zardoy.site/maps" + "mapsProvider": "https://maps.mcraft.fun/" } diff --git a/esbuild.mjs b/esbuild.mjs index 7c0f093d..536735d6 100644 --- a/esbuild.mjs +++ b/esbuild.mjs @@ -71,7 +71,8 @@ const buildOptions = { 'process.env.NODE_ENV': JSON.stringify(dev ? 'development' : 'production'), 'process.env.BUILD_VERSION': JSON.stringify(!dev ? buildingVersion : 'undefined'), 'process.env.GITHUB_URL': - JSON.stringify(`https://github.com/${process.env.GITHUB_REPOSITORY || `${process.env.VERCEL_GIT_REPO_OWNER}/${process.env.VERCEL_GIT_REPO_SLUG}`}`) + JSON.stringify(`https://github.com/${process.env.GITHUB_REPOSITORY || `${process.env.VERCEL_GIT_REPO_OWNER}/${process.env.VERCEL_GIT_REPO_SLUG}`}`), + 'process.env.DEPS_VERSIONS': JSON.stringify({}) }, loader: { // todo use external or resolve issues with duplicating diff --git a/index.html b/index.html index 6a273589..0cc59068 100644 --- a/index.html +++ b/index.html @@ -4,41 +4,53 @@ - - + + }) + + Prismarine Web Client diff --git a/package.json b/package.json index 7f2f8c0b..7a20537f 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@dimaka/interface": "0.0.3-alpha.0", "@floating-ui/react": "^0.26.1", "@mui/base": "5.0.0-beta.34", + "@nxg-org/mineflayer-tracker": "^1.2.1", "@types/react": "^18.2.20", "@types/react-dom": "^18.2.7", "@types/wicg-file-system-access": "^2023.10.2", @@ -53,7 +54,7 @@ "lit": "^2.8.0", "lodash-es": "^4.17.21", "minecraft-assets": "^1.12.2", - "minecraft-data": "3.60.0", + "minecraft-data": "3.61.2", "net-browserify": "github:zardoy/prismarinejs-net-browserify", "node-gzip": "^1.1.2", "peerjs": "^1.5.0", @@ -64,10 +65,12 @@ "react-transition-group": "^4.4.5", "sanitize-filename": "^1.6.3", "skinview3d": "^3.0.1", + "source-map-js": "^1.0.2", "stats-gl": "^1.0.5", "stats.js": "^0.17.0", "tabbable": "^6.2.0", "title-case": "3.x", + "ua-parser-js": "^1.0.37", "valtio": "^1.11.1", "workbox-build": "^7.0.0" }, @@ -127,7 +130,7 @@ "diamond-square": "github:zardoy/diamond-square", "prismarine-block": "github:zardoy/prismarine-block#next-era", "prismarine-world": "github:zardoy/prismarine-world#next-era", - "minecraft-data": "3.60.0", + "minecraft-data": "3.61.2", "prismarine-provider-anvil": "github:zardoy/prismarine-provider-anvil#everything", "minecraft-protocol": "github:zardoy/minecraft-protocol#everything", "react": "^18.2.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 99e3bb81..dec08c52 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,7 +9,7 @@ overrides: diamond-square: github:zardoy/diamond-square prismarine-block: github:zardoy/prismarine-block#next-era prismarine-world: github:zardoy/prismarine-world#next-era - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 prismarine-provider-anvil: github:zardoy/prismarine-provider-anvil#everything minecraft-protocol: github:zardoy/minecraft-protocol#everything react: ^18.2.0 @@ -27,6 +27,9 @@ importers: '@mui/base': specifier: 5.0.0-beta.34 version: 5.0.0-beta.34(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0) + '@nxg-org/mineflayer-tracker': + specifier: ^1.2.1 + version: 1.2.1 '@types/react': specifier: ^18.2.20 version: 18.2.20 @@ -97,8 +100,8 @@ importers: specifier: ^1.12.2 version: 1.12.2 minecraft-data: - specifier: 3.60.0 - version: 3.60.0 + specifier: 3.61.2 + version: 3.61.2 net-browserify: specifier: github:zardoy/prismarinejs-net-browserify version: github.com/zardoy/prismarinejs-net-browserify/7d827dba61bd2f9ac9a6086fe2079a0fccadd070 @@ -129,6 +132,9 @@ importers: skinview3d: specifier: ^3.0.1 version: 3.0.1 + source-map-js: + specifier: ^1.0.2 + version: 1.0.2 stats-gl: specifier: ^1.0.5 version: 1.0.5 @@ -141,6 +147,9 @@ importers: title-case: specifier: 3.x version: 3.0.3 + ua-parser-js: + specifier: ^1.0.37 + version: 1.0.37 valtio: specifier: ^1.11.1 version: 1.11.2(@types/react@18.2.20)(react@18.2.0) @@ -150,7 +159,7 @@ importers: optionalDependencies: systeminformation: specifier: ^5.21.22 - version: 5.21.22 + version: 5.21.24 devDependencies: '@storybook/addon-essentials': specifier: ^7.4.6 @@ -166,13 +175,13 @@ importers: version: 7.4.6(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2) '@storybook/react-vite': specifier: ^7.4.6 - version: 7.4.6(react-dom@18.2.0)(react@18.2.0)(rollup@2.79.1)(typescript@5.2.2)(vite@4.5.0) + version: 7.4.6(react-dom@18.2.0)(react@18.2.0)(rollup@2.79.1)(typescript@5.2.2)(vite@4.5.2) '@storybook/web-components': specifier: ^7.4.6 version: 7.4.6(lit@2.8.0)(react-dom@18.2.0)(react@18.2.0) '@storybook/web-components-vite': specifier: ^7.4.6 - version: 7.4.6(lit@2.8.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(vite@4.5.0) + version: 7.4.6(lit@2.8.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(vite@4.5.2) '@types/lodash-es': specifier: ^4.17.9 version: 4.17.9 @@ -235,10 +244,10 @@ importers: version: 1.0.0 minecraft-inventory-gui: specifier: github:zardoy/minecraft-inventory-gui#next - version: github.com/zardoy/minecraft-inventory-gui/69003692b3041d94a420a65c7d3cc1b37737e838(@types/react@18.2.20)(react@18.2.0) + version: github.com/zardoy/minecraft-inventory-gui/bf2e7ba3afdc606604d85682d081778281d533cb(@types/react@18.2.20)(react@18.2.0) mineflayer: specifier: github:PrismarineJS/mineflayer - version: github.com/PrismarineJS/mineflayer/cc98f1307e3ab48477d2a9ff29da4447f42b30bc + version: github.com/PrismarineJS/mineflayer/b9491ae508dc52e4538dd66eb6f47a639facde20 mineflayer-pathfinder: specifier: ^2.4.4 version: 2.4.4 @@ -325,7 +334,7 @@ importers: version: github.com/zardoy/prismarine-block/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-chunk: specifier: ^1.22.0 - version: 1.35.0(minecraft-data@3.60.0) + version: 1.35.0(minecraft-data@3.61.2) prismarine-schematic: specifier: ^1.2.0 version: 1.2.3 @@ -397,15 +406,15 @@ packages: default-browser-id: 3.0.0 dev: true - /@azure/msal-common@14.3.0: - resolution: {integrity: sha512-nKwhWW7QbiziXG8lcebCqbyxiuJAdBik7SBu3vPdJJ+rUr8M2uigAIi5OY7FwddRahlYzLMGG8U1oMeEOulNqQ==} + /@azure/msal-common@14.7.0: + resolution: {integrity: sha512-WexujW5jKWib7xtIxR7fEVyd5xcA3FNwenELy2HO4YC/ivTFdsEcDhtpKQuRUHqXRwxoqBblyZzTAhBm4v6fHA==} engines: {node: '>=0.8.0'} - /@azure/msal-node@2.4.0: - resolution: {integrity: sha512-Le2UhUs+RhEoEQ+/BZxqrDw74yq1jlqUeovo43IE4clHEbtWaX+KdUFrdWxLe4RQemA4jPEZwBiODvKhbOxafg==} - engines: {node: 18 || 20} + /@azure/msal-node@2.6.3: + resolution: {integrity: sha512-ojjJqUwb297T5Tcln4PbJANFEqRXfbQXcyOrtdr1HQYIo+dSuCT/o0nG6bFVihf6fcNykDwJLCQPVXzTkx/oGg==} + engines: {node: '>=16'} dependencies: - '@azure/msal-common': 14.3.0 + '@azure/msal-common': 14.7.0 jsonwebtoken: 9.0.2 uuid: 8.3.2 @@ -1705,48 +1714,48 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@cbor-extract/cbor-extract-darwin-arm64@2.1.1: - resolution: {integrity: sha512-blVBy5MXz6m36Vx0DfLd7PChOQKEs8lK2bD1WJn/vVgG4FXZiZmZb2GECHFvVPA5T7OnODd9xZiL3nMCv6QUhA==} + /@cbor-extract/cbor-extract-darwin-arm64@2.2.0: + resolution: {integrity: sha512-P7swiOAdF7aSi0H+tHtHtr6zrpF3aAq/W9FXx5HektRvLTM2O89xCyXF3pk7pLc7QpaY7AoaE8UowVf9QBdh3w==} cpu: [arm64] os: [darwin] requiresBuild: true dev: false optional: true - /@cbor-extract/cbor-extract-darwin-x64@2.1.1: - resolution: {integrity: sha512-h6KFOzqk8jXTvkOftyRIWGrd7sKQzQv2jVdTL9nKSf3D2drCvQB/LHUxAOpPXo3pv2clDtKs3xnHalpEh3rDsw==} + /@cbor-extract/cbor-extract-darwin-x64@2.2.0: + resolution: {integrity: sha512-1liF6fgowph0JxBbYnAS7ZlqNYLf000Qnj4KjqPNW4GViKrEql2MgZnAsExhY9LSy8dnvA4C0qHEBgPrll0z0w==} cpu: [x64] os: [darwin] requiresBuild: true dev: false optional: true - /@cbor-extract/cbor-extract-linux-arm64@2.1.1: - resolution: {integrity: sha512-SxAaRcYf8S0QHaMc7gvRSiTSr7nUYMqbUdErBEu+HYA4Q6UNydx1VwFE68hGcp1qvxcy9yT5U7gA+a5XikfwSQ==} + /@cbor-extract/cbor-extract-linux-arm64@2.2.0: + resolution: {integrity: sha512-rQvhNmDuhjTVXSPFLolmQ47/ydGOFXtbR7+wgkSY0bdOxCFept1hvg59uiLPT2fVDuJFuEy16EImo5tE2x3RsQ==} cpu: [arm64] os: [linux] requiresBuild: true dev: false optional: true - /@cbor-extract/cbor-extract-linux-arm@2.1.1: - resolution: {integrity: sha512-ds0uikdcIGUjPyraV4oJqyVE5gl/qYBpa/Wnh6l6xLE2lj/hwnjT2XcZCChdXwW/YFZ1LUHs6waoYN8PmK0nKQ==} + /@cbor-extract/cbor-extract-linux-arm@2.2.0: + resolution: {integrity: sha512-QeBcBXk964zOytiedMPQNZr7sg0TNavZeuUCD6ON4vEOU/25+pLhNN6EDIKJ9VLTKaZ7K7EaAriyYQ1NQ05s/Q==} cpu: [arm] os: [linux] requiresBuild: true dev: false optional: true - /@cbor-extract/cbor-extract-linux-x64@2.1.1: - resolution: {integrity: sha512-GVK+8fNIE9lJQHAlhOROYiI0Yd4bAZ4u++C2ZjlkS3YmO6hi+FUxe6Dqm+OKWTcMpL/l71N6CQAmaRcb4zyJuA==} + /@cbor-extract/cbor-extract-linux-x64@2.2.0: + resolution: {integrity: sha512-cWLAWtT3kNLHSvP4RKDzSTX9o0wvQEEAj4SKvhWuOVZxiDAeQazr9A+PSiRILK1VYMLeDml89ohxCnUNQNQNCw==} cpu: [x64] os: [linux] requiresBuild: true dev: false optional: true - /@cbor-extract/cbor-extract-win32-x64@2.1.1: - resolution: {integrity: sha512-2Niq1C41dCRIDeD8LddiH+mxGlO7HJ612Ll3D/E73ZWBmycued+8ghTr/Ho3CMOWPUEr08XtyBMVXAjqF+TcKw==} + /@cbor-extract/cbor-extract-win32-x64@2.2.0: + resolution: {integrity: sha512-l2M+Z8DO2vbvADOBNLbbh9y5ST1RY5sqkWOg/58GkUPBYou/cuNZ68SGQ644f1CvZ8kcOxyZtw06+dxWHIoN/w==} cpu: [x64] os: [win32] requiresBuild: true @@ -3099,7 +3108,7 @@ packages: regenerator-runtime: 0.13.11 dev: false - /@joshwooding/vite-plugin-react-docgen-typescript@0.2.1(typescript@5.2.2)(vite@4.5.0): + /@joshwooding/vite-plugin-react-docgen-typescript@0.2.1(typescript@5.2.2)(vite@4.5.2): resolution: {integrity: sha512-ou4ZJSXMMWHqGS4g8uNRbC5TiTWxAgQZiVucoUrOCWuPrTbkpJbmVyIi9jU72SBry7gQtuMEDp4YR8EEXAg7VQ==} peerDependencies: typescript: '>= 4.3.x' @@ -3113,7 +3122,7 @@ packages: magic-string: 0.27.0 react-docgen-typescript: 2.2.2(typescript@5.2.2) typescript: 5.2.2 - vite: 4.5.0 + vite: 4.5.2 dev: true /@jridgewell/gen-mapping@0.3.3: @@ -3298,6 +3307,23 @@ packages: dev: false optional: true + /@nxg-org/mineflayer-tracker@1.2.1: + resolution: {integrity: sha512-SI1ffF8zvg3/ZNE021Ja2W0FZPN+WbQDZf8yFqOcXtPRXAtM9W6HvoACdzXep8BZid7WYgYLIgjKpB+9RqvCNQ==} + dependencies: + '@nxg-org/mineflayer-trajectories': 1.1.1 + '@nxg-org/mineflayer-util-plugin': 1.8.3 + dev: false + + /@nxg-org/mineflayer-trajectories@1.1.1: + resolution: {integrity: sha512-X103KXlX8+L3uMeK4jQxMUdTizv01sQRSfBizAF/iOAdfQZehRLXr3CYKeJzfwPYGLN0X0JCl++cMEcZVn4vbg==} + dependencies: + '@nxg-org/mineflayer-util-plugin': 1.8.3 + dev: false + + /@nxg-org/mineflayer-util-plugin@1.8.3: + resolution: {integrity: sha512-YlIbzCDs9822xuvmYlD0vXZz0iye9buqp9NK4nNn15gYybdqBtC/YxK6BLqXtwNohZCKoZdKgei7Xd5Bt2/rUg==} + dev: false + /@pkgjs/parseargs@0.11.0: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -4304,7 +4330,7 @@ packages: - supports-color dev: true - /@storybook/builder-vite@7.4.6(typescript@5.2.2)(vite@4.5.0): + /@storybook/builder-vite@7.4.6(typescript@5.2.2)(vite@4.5.2): resolution: {integrity: sha512-xV9STYK+TkqWWTf2ydm6jx+7P70fjD2UPd1XTUw08uKszIjhuuxk+bG/OF5R1E25mPunAKXm6kBFh351AKejBg==} peerDependencies: '@preact/preset-vite': '*' @@ -4339,7 +4365,7 @@ packages: remark-slug: 6.1.0 rollup: 3.29.4 typescript: 5.2.2 - vite: 4.5.0 + vite: 4.5.2 transitivePeerDependencies: - encoding - supports-color @@ -4680,7 +4706,7 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: true - /@storybook/react-vite@7.4.6(react-dom@18.2.0)(react@18.2.0)(rollup@2.79.1)(typescript@5.2.2)(vite@4.5.0): + /@storybook/react-vite@7.4.6(react-dom@18.2.0)(react@18.2.0)(rollup@2.79.1)(typescript@5.2.2)(vite@4.5.2): resolution: {integrity: sha512-jkjnrf3FxzR5wcmebXRPflrsM4WIDjWyW/NVFJwxi5PeIOk7fE7/QAPrm4NFRUu2Q7DeuH3oLKsw8bigvUI9RA==} engines: {node: '>=16'} peerDependencies: @@ -4688,17 +4714,17 @@ packages: react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 vite: ^3.0.0 || ^4.0.0 dependencies: - '@joshwooding/vite-plugin-react-docgen-typescript': 0.2.1(typescript@5.2.2)(vite@4.5.0) + '@joshwooding/vite-plugin-react-docgen-typescript': 0.2.1(typescript@5.2.2)(vite@4.5.2) '@rollup/pluginutils': 5.0.5(rollup@2.79.1) - '@storybook/builder-vite': 7.4.6(typescript@5.2.2)(vite@4.5.0) + '@storybook/builder-vite': 7.4.6(typescript@5.2.2)(vite@4.5.2) '@storybook/react': 7.4.6(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2) - '@vitejs/plugin-react': 3.1.0(vite@4.5.0) + '@vitejs/plugin-react': 3.1.0(vite@4.5.2) ast-types: 0.14.2 magic-string: 0.30.4 react: 18.2.0 react-docgen: 6.0.0-alpha.3 react-dom: 18.2.0(react@18.2.0) - vite: 4.5.0 + vite: 4.5.2 transitivePeerDependencies: - '@preact/preset-vite' - encoding @@ -4800,14 +4826,14 @@ packages: file-system-cache: 2.3.0 dev: true - /@storybook/web-components-vite@7.4.6(lit@2.8.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(vite@4.5.0): + /@storybook/web-components-vite@7.4.6(lit@2.8.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(vite@4.5.2): resolution: {integrity: sha512-L/y6MTLbqfHaM0faK9Yl8n5PIyW4daZrtk7NfaOT6UjgNFjOx3o4CctYew6oj90cNk5HdZQX2OZny043GxDLZw==} engines: {node: ^14.18 || >=16} peerDependencies: react: ^18.2.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: - '@storybook/builder-vite': 7.4.6(typescript@5.2.2)(vite@4.5.0) + '@storybook/builder-vite': 7.4.6(typescript@5.2.2)(vite@4.5.2) '@storybook/core-server': 7.4.6 '@storybook/node-logger': 7.4.6 '@storybook/web-components': 7.4.6(lit@2.8.0)(react-dom@18.2.0)(react@18.2.0) @@ -5092,6 +5118,11 @@ packages: resolution: {integrity: sha512-YGncyA25/MaVtQkjWW9r0EFBukZ+JulsLcVZBlGUfIb96OBMjkoRWwQo5IEWJ8Fj06Go3GHw+bjYDitv6BaGsA==} dev: true + /@types/node@20.11.19: + resolution: {integrity: sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==} + dependencies: + undici-types: 5.26.5 + /@types/node@20.8.0: resolution: {integrity: sha512-LzcWltT83s1bthcvjBmiBvGJiiUe84NWRHkw+ZV6Fr41z2FbIzvc815dk2nQ3RAKMuN2fkenM/z3Xv2QzEpYxQ==} @@ -5153,10 +5184,10 @@ packages: '@types/scheduler': 0.16.3 csstype: 3.1.2 - /@types/readable-stream@4.0.4: - resolution: {integrity: sha512-NSAiePj3Iq3kBArfpUWRNX/mRw8DibYD6YhNCIJDfUP/iIOQYsNJgtHyjpbuZlcbL7TxILS8qYjY/nXXvtcFQg==} + /@types/readable-stream@4.0.10: + resolution: {integrity: sha512-AbUKBjcC8SHmImNi4yK2bbjogQlkFSg7shZCcicxPQapniOlajG8GCc39lvXzCWX4lLRRs7DM3VAeSlqmEVZUA==} dependencies: - '@types/node': 20.8.10 + '@types/node': 20.11.19 safe-buffer: 5.1.2 /@types/resolve@1.17.1: @@ -5249,8 +5280,8 @@ packages: '@types/node': 20.8.0 dev: true - /@types/yauzl@2.10.2: - resolution: {integrity: sha512-Km7XAtUIduROw7QPgvcft0lIupeG8a8rdKL8RiSyKvlE7dYY31fEn41HVuQsRFDuROA8tA4K2UVL+WdfFmErBA==} + /@types/yauzl@2.10.3: + resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: '@types/node': 20.8.10 @@ -5430,7 +5461,7 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@vitejs/plugin-react@3.1.0(vite@4.5.0): + /@vitejs/plugin-react@3.1.0(vite@4.5.2): resolution: {integrity: sha512-AfgcRL8ZBhAlc3BFdigClmTUMISmmzHn7sB2h9U1odvc5U/MjWXsAaz18b/WoppUTDBzxOJwo2VdClfUcItu9g==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -5441,7 +5472,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.22.5(@babel/core@7.22.11) magic-string: 0.27.0 react-refresh: 0.14.0 - vite: 4.5.0 + vite: 4.5.2 transitivePeerDependencies: - supports-color dev: true @@ -5601,18 +5632,18 @@ packages: exit-hook: 2.2.1 flatmap: 0.0.3 long: 5.2.3 - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 minecraft-protocol: github.com/zardoy/minecraft-protocol/2c14a686bfe7cbd9a5c87b629b402295ee86219f mkdirp: 2.1.6 moment: 2.29.4 needle: 2.9.1 node-gzip: 1.1.2 node-rsa: 1.1.1 - prismarine-chunk: 1.35.0(minecraft-data@3.60.0) + prismarine-chunk: 1.35.0(minecraft-data@3.61.2) prismarine-entity: 2.3.1 prismarine-item: 1.14.0 prismarine-nbt: 2.5.0 - prismarine-provider-anvil: github.com/zardoy/prismarine-provider-anvil/0ddcd9d48574113308e1fbebef60816aced0846f(minecraft-data@3.60.0) + prismarine-provider-anvil: github.com/zardoy/prismarine-provider-anvil/0ddcd9d48574113308e1fbebef60816aced0846f(minecraft-data@3.61.2) prismarine-windows: 2.8.0 prismarine-world: github.com/zardoy/prismarine-world/c358222204d21fe7d45379fbfcefb047f926c786 random-seed: 0.3.0 @@ -5888,6 +5919,14 @@ packages: call-bind: 1.0.2 is-array-buffer: 3.0.2 + /array-buffer-byte-length@1.0.1: + resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + is-array-buffer: 3.0.4 + dev: true + /array-flatten@1.1.1: resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} @@ -5927,14 +5966,14 @@ packages: es-shim-unscopables: 1.0.0 dev: true - /array.prototype.tosorted@1.1.2: - resolution: {integrity: sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==} + /array.prototype.tosorted@1.1.3: + resolution: {integrity: sha512-/DdH4TiTmOKzyQbp/eadcCVexiCb36xJg7HshYOYJnNZFDj33GEv0P7GxsynpShhq4OLYJzbGcBDkLsDt7MnNg==} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.22.4 + es-errors: 1.3.0 es-shim-unscopables: 1.0.2 - get-intrinsic: 1.2.2 dev: true /arraybuffer.prototype.slice@1.0.2: @@ -5949,6 +5988,20 @@ packages: is-array-buffer: 3.0.2 is-shared-array-buffer: 1.0.2 + /arraybuffer.prototype.slice@1.0.3: + resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.22.4 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 + is-array-buffer: 3.0.4 + is-shared-array-buffer: 1.0.2 + dev: true + /arraybuffer.slice@0.0.7: resolution: {integrity: sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==} dev: false @@ -6048,6 +6101,11 @@ packages: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} engines: {node: '>= 0.4'} + /available-typed-arrays@1.0.6: + resolution: {integrity: sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==} + engines: {node: '>= 0.4'} + dev: true + /aws-sign2@0.7.0: resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} @@ -6057,7 +6115,7 @@ packages: /axios@0.21.4(debug@4.3.4): resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} dependencies: - follow-redirects: 1.15.3(debug@4.3.4) + follow-redirects: 1.15.5(debug@4.3.4) transitivePeerDependencies: - debug @@ -6477,12 +6535,15 @@ packages: function-bind: 1.1.1 get-intrinsic: 1.2.1 - /call-bind@1.0.5: - resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} + /call-bind@1.0.7: + resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} + engines: {node: '>= 0.4'} dependencies: + es-define-property: 1.0.0 + es-errors: 1.3.0 function-bind: 1.1.2 - get-intrinsic: 1.2.2 - set-function-length: 1.1.1 + get-intrinsic: 1.2.4 + set-function-length: 1.2.1 dev: true /callsites@3.1.0: @@ -6543,26 +6604,26 @@ packages: /caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} - /cbor-extract@2.1.1: - resolution: {integrity: sha512-1UX977+L+zOJHsp0mWFG13GLwO6ucKgSmSW6JTl8B9GUvACvHeIVpFqhU92299Z6PfD09aTXDell5p+lp1rUFA==} + /cbor-extract@2.2.0: + resolution: {integrity: sha512-Ig1zM66BjLfTXpNgKpvBePq271BPOvu8MR0Jl080yG7Jsl+wAZunfrwiwA+9ruzm/WEdIV5QF/bjDZTqyAIVHA==} hasBin: true requiresBuild: true dependencies: - node-gyp-build-optional-packages: 5.0.3 + node-gyp-build-optional-packages: 5.1.1 optionalDependencies: - '@cbor-extract/cbor-extract-darwin-arm64': 2.1.1 - '@cbor-extract/cbor-extract-darwin-x64': 2.1.1 - '@cbor-extract/cbor-extract-linux-arm': 2.1.1 - '@cbor-extract/cbor-extract-linux-arm64': 2.1.1 - '@cbor-extract/cbor-extract-linux-x64': 2.1.1 - '@cbor-extract/cbor-extract-win32-x64': 2.1.1 + '@cbor-extract/cbor-extract-darwin-arm64': 2.2.0 + '@cbor-extract/cbor-extract-darwin-x64': 2.2.0 + '@cbor-extract/cbor-extract-linux-arm': 2.2.0 + '@cbor-extract/cbor-extract-linux-arm64': 2.2.0 + '@cbor-extract/cbor-extract-linux-x64': 2.2.0 + '@cbor-extract/cbor-extract-win32-x64': 2.2.0 dev: false optional: true /cbor-x@1.5.4: resolution: {integrity: sha512-PVKILDn+Rf6MRhhcyzGXi5eizn1i0i3F8Fe6UMMxXBnWkalq9+C5+VTmlIjAYM4iF2IYF2N+zToqAfYOp+3rfw==} optionalDependencies: - cbor-extract: 2.1.1 + cbor-extract: 2.2.0 dev: false /chai@4.3.10: @@ -7299,13 +7360,13 @@ packages: gopd: 1.0.1 has-property-descriptors: 1.0.0 - /define-data-property@1.1.1: - resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} + /define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.2.2 + es-define-property: 1.0.0 + es-errors: 1.3.0 gopd: 1.0.1 - has-property-descriptors: 1.0.1 dev: true /define-lazy-prop@2.0.0: @@ -7390,6 +7451,7 @@ packages: /detect-libc@2.0.2: resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} engines: {node: '>=8'} + requiresBuild: true dev: false /detect-node-es@1.1.0: @@ -7790,68 +7852,84 @@ packages: unbox-primitive: 1.0.2 which-typed-array: 1.1.11 - /es-abstract@1.22.3: - resolution: {integrity: sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==} + /es-abstract@1.22.4: + resolution: {integrity: sha512-vZYJlk2u6qHYxBOTjAeg7qUxHdNfih64Uu2J8QqWgXZ2cri0ZpJAkzDUK/q593+mvKwlxyaxr6F1Q+3LKoQRgg==} engines: {node: '>= 0.4'} dependencies: - array-buffer-byte-length: 1.0.0 - arraybuffer.prototype.slice: 1.0.2 - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 + array-buffer-byte-length: 1.0.1 + arraybuffer.prototype.slice: 1.0.3 + available-typed-arrays: 1.0.6 + call-bind: 1.0.7 + es-define-property: 1.0.0 + es-errors: 1.3.0 es-set-tostringtag: 2.0.2 es-to-primitive: 1.2.1 function.prototype.name: 1.1.6 - get-intrinsic: 1.2.2 - get-symbol-description: 1.0.0 + get-intrinsic: 1.2.4 + get-symbol-description: 1.0.2 globalthis: 1.0.3 gopd: 1.0.1 - has-property-descriptors: 1.0.1 + has-property-descriptors: 1.0.2 has-proto: 1.0.1 has-symbols: 1.0.3 - hasown: 2.0.0 - internal-slot: 1.0.6 - is-array-buffer: 3.0.2 + hasown: 2.0.1 + internal-slot: 1.0.7 + is-array-buffer: 3.0.4 is-callable: 1.2.7 is-negative-zero: 2.0.2 is-regex: 1.1.4 is-shared-array-buffer: 1.0.2 is-string: 1.0.7 - is-typed-array: 1.1.12 + is-typed-array: 1.1.13 is-weakref: 1.0.2 object-inspect: 1.13.1 object-keys: 1.1.1 - object.assign: 4.1.4 - regexp.prototype.flags: 1.5.1 - safe-array-concat: 1.0.1 - safe-regex-test: 1.0.0 + object.assign: 4.1.5 + regexp.prototype.flags: 1.5.2 + safe-array-concat: 1.1.0 + safe-regex-test: 1.0.3 string.prototype.trim: 1.2.8 string.prototype.trimend: 1.0.7 string.prototype.trimstart: 1.0.7 - typed-array-buffer: 1.0.0 + typed-array-buffer: 1.0.1 typed-array-byte-length: 1.0.0 typed-array-byte-offset: 1.0.0 typed-array-length: 1.0.4 unbox-primitive: 1.0.2 - which-typed-array: 1.1.13 + which-typed-array: 1.1.14 dev: true - /es-iterator-helpers@1.0.15: - resolution: {integrity: sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==} + /es-define-property@1.0.0: + resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.4 + dev: true + + /es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + dev: true + + /es-iterator-helpers@1.0.17: + resolution: {integrity: sha512-lh7BsUqelv4KUbR5a/ZTaGGIMLCjPGPqJ6q+Oq24YP0RdyptX1uzm4vvaqzk7Zx3bpl/76YLTTDj9L7uYQ92oQ==} + engines: {node: '>= 0.4'} dependencies: asynciterator.prototype: 1.0.0 - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.22.4 + es-errors: 1.3.0 es-set-tostringtag: 2.0.2 function-bind: 1.1.2 - get-intrinsic: 1.2.2 + get-intrinsic: 1.2.4 globalthis: 1.0.3 - has-property-descriptors: 1.0.1 + has-property-descriptors: 1.0.2 has-proto: 1.0.1 has-symbols: 1.0.3 - internal-slot: 1.0.6 + internal-slot: 1.0.7 iterator.prototype: 1.1.2 - safe-array-concat: 1.0.1 + safe-array-concat: 1.1.0 dev: true /es-module-lexer@0.9.3: @@ -7870,9 +7948,9 @@ packages: resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.2.2 - has-tostringtag: 1.0.0 - hasown: 2.0.0 + get-intrinsic: 1.2.4 + has-tostringtag: 1.0.2 + hasown: 2.0.1 dev: true /es-shim-unscopables@1.0.0: @@ -7884,7 +7962,7 @@ packages: /es-shim-unscopables@1.0.2: resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} dependencies: - hasown: 2.0.0 + hasown: 2.0.1 dev: true /es-to-primitive@1.2.1: @@ -8259,9 +8337,9 @@ packages: dependencies: array-includes: 3.1.7 array.prototype.flatmap: 1.3.2 - array.prototype.tosorted: 1.1.2 + array.prototype.tosorted: 1.1.3 doctrine: 2.1.0 - es-iterator-helpers: 1.0.15 + es-iterator-helpers: 1.0.17 eslint: 8.50.0 estraverse: 5.3.0 jsx-ast-utils: 3.3.5 @@ -8599,7 +8677,7 @@ packages: get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: - '@types/yauzl': 2.10.2 + '@types/yauzl': 2.10.3 transitivePeerDependencies: - supports-color @@ -8802,6 +8880,18 @@ packages: optional: true dependencies: debug: 4.3.4(supports-color@8.1.1) + dev: true + + /follow-redirects@1.15.5(debug@4.3.4): + resolution: {integrity: sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dependencies: + debug: 4.3.4(supports-color@8.1.1) /for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -8976,13 +9066,15 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 - /get-intrinsic@1.2.2: - resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + /get-intrinsic@1.2.4: + resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} + engines: {node: '>= 0.4'} dependencies: + es-errors: 1.3.0 function-bind: 1.1.2 has-proto: 1.0.1 has-symbols: 1.0.3 - hasown: 2.0.0 + hasown: 2.0.1 dev: true /get-nonce@1.0.1: @@ -9027,6 +9119,15 @@ packages: call-bind: 1.0.2 get-intrinsic: 1.2.1 + /get-symbol-description@1.0.2: + resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 + dev: true + /get-tsconfig@4.7.2: resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} dependencies: @@ -9266,10 +9367,10 @@ packages: dependencies: get-intrinsic: 1.2.1 - /has-property-descriptors@1.0.1: - resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} + /has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} dependencies: - get-intrinsic: 1.2.2 + es-define-property: 1.0.0 dev: true /has-proto@1.0.1: @@ -9286,6 +9387,13 @@ packages: dependencies: has-symbols: 1.0.3 + /has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + /has-unicode@2.0.1: resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} dev: false @@ -9312,8 +9420,8 @@ packages: minimalistic-assert: 1.0.1 dev: true - /hasown@2.0.0: - resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + /hasown@2.0.1: + resolution: {integrity: sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==} engines: {node: '>= 0.4'} dependencies: function-bind: 1.1.2 @@ -9611,13 +9719,13 @@ packages: has: 1.0.3 side-channel: 1.0.4 - /internal-slot@1.0.6: - resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} + /internal-slot@1.0.7: + resolution: {integrity: sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.2.2 - hasown: 2.0.0 - side-channel: 1.0.4 + es-errors: 1.3.0 + hasown: 2.0.1 + side-channel: 1.0.5 dev: true /invariant@2.2.4: @@ -9652,6 +9760,14 @@ packages: get-intrinsic: 1.2.1 is-typed-array: 1.1.12 + /is-array-buffer@3.0.4: + resolution: {integrity: sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + get-intrinsic: 1.2.4 + dev: true + /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} @@ -9663,7 +9779,7 @@ packages: resolution: {integrity: sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==} engines: {node: '>= 0.4'} dependencies: - has-tostringtag: 1.0.0 + has-tostringtag: 1.0.2 dev: true /is-bigint@1.0.4: @@ -9710,7 +9826,7 @@ packages: /is-core-module@2.13.1: resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} dependencies: - hasown: 2.0.0 + hasown: 2.0.1 dev: true /is-date-object@1.0.5: @@ -9737,7 +9853,7 @@ packages: /is-finalizationregistry@1.0.2: resolution: {integrity: sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 dev: true /is-fullwidth-code-point@3.0.0: @@ -9888,6 +10004,13 @@ packages: dependencies: which-typed-array: 1.1.11 + /is-typed-array@1.1.13: + resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.14 + dev: true + /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} @@ -9907,8 +10030,8 @@ packages: /is-weakset@2.0.2: resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==} dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 + call-bind: 1.0.7 + get-intrinsic: 1.2.4 dev: true /is-wsl@2.2.0: @@ -9984,9 +10107,9 @@ packages: resolution: {integrity: sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==} dependencies: define-properties: 1.2.1 - get-intrinsic: 1.2.2 + get-intrinsic: 1.2.4 has-symbols: 1.0.3 - reflect.getprototypeof: 1.0.4 + reflect.getprototypeof: 1.0.5 set-function-name: 2.0.1 dev: true @@ -10236,7 +10359,7 @@ packages: lodash.isstring: 4.0.1 lodash.once: 4.1.1 ms: 2.1.3 - semver: 7.5.4 + semver: 7.6.0 /jsprim@2.0.2: resolution: {integrity: sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==} @@ -10253,7 +10376,7 @@ packages: dependencies: array-includes: 3.1.7 array.prototype.flat: 1.3.2 - object.assign: 4.1.4 + object.assign: 4.1.5 object.values: 1.1.7 dev: true @@ -10791,8 +10914,8 @@ packages: resolution: {integrity: sha512-/eMxh3LNjCXOnU6KnQMjBM8dRnoJNpWIg7mD2m2RthraYiQK2FNzPWIKxWm2j3Ufcf5nzFXupgABledE86r4fQ==} dev: false - /minecraft-data@3.60.0: - resolution: {integrity: sha512-zTS2DsFZBvHsYCUaKL+E0mSbrgAAX5DJzYmlskh/6WnVV7lxftW7jDjR8SMgGoBBS1V0TZ79BWp3+aD3r8wKIg==} + /minecraft-data@3.61.2: + resolution: {integrity: sha512-4RsP5rkQx78ZaOKWGeVidc+PjH+DFzNFrQMtSVAgabDOHDWrhSaOlpkxpltHy+vYUyLhglfAkc2g1DUkgHQcTQ==} /minecraft-folder-path@1.2.0: resolution: {integrity: sha512-qaUSbKWoOsH9brn0JQuBhxNAzTDMwrOXorwuRxdJKKKDYvZhtml+6GVCUrY5HRiEsieBEjCUnhVpDuQiKsiFaw==} @@ -10828,7 +10951,7 @@ packages: /mineflayer-pathfinder@2.4.4: resolution: {integrity: sha512-HAXakZrJRb1UC+5dv8EaDrqjW3ZnBnBk3nkb6x/YWyhHCUKn/E7VU0FO+UN9whuqPlkSaVumEdXJdydE6lSYxQ==} dependencies: - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 prismarine-block: github.com/zardoy/prismarine-block/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-entity: 2.3.1 prismarine-item: 1.14.0 @@ -11041,6 +11164,12 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + /napi-build-utils@1.0.2: resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} requiresBuild: true @@ -11145,10 +11274,12 @@ packages: dependencies: whatwg-url: 5.0.0 - /node-gyp-build-optional-packages@5.0.3: - resolution: {integrity: sha512-k75jcVzk5wnnc/FMxsf4udAoTEUv2jY3ycfdSd3yWu6Cnd1oee6/CfZJApyscA4FJOmdoixWwiwOyf16RzD5JA==} + /node-gyp-build-optional-packages@5.1.1: + resolution: {integrity: sha512-+P72GAjVAbTxjjwUmwjVrqrdZROD4nf8KgpBoDxqXXTiYZZt/ud60dE5yvCSr9lRO8e8yv6kgJIC0K0PfZFVQw==} hasBin: true requiresBuild: true + dependencies: + detect-libc: 2.0.2 dev: false optional: true @@ -11333,29 +11464,39 @@ packages: has-symbols: 1.0.3 object-keys: 1.1.1 + /object.assign@4.1.5: + resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + /object.entries@1.1.7: resolution: {integrity: sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.22.4 dev: true /object.fromentries@2.0.7: resolution: {integrity: sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.22.4 dev: true /object.hasown@1.1.3: resolution: {integrity: sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==} dependencies: define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.22.4 dev: true /object.values@1.1.7: @@ -11818,6 +11959,15 @@ packages: picocolors: 1.0.0 source-map-js: 1.0.2 + /postcss@8.4.35: + resolution: {integrity: sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + /potpack@1.0.2: resolution: {integrity: sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==} dev: false @@ -11881,10 +12031,10 @@ packages: engines: {node: '>= 0.8'} dev: true - /prismarine-auth@2.3.0: - resolution: {integrity: sha512-giKZiHwuQdpMJ7KX94UncOJqM3u+yqKIR2UI/rqmdmFUuQilV9vhlz/zehpVkvo7FE8gmZsuUMCUPhI+gtgd3A==} + /prismarine-auth@2.4.1: + resolution: {integrity: sha512-DwDI3Ucxf/eThJJo5QVzlywFrJulL1fK1z6F8bybvddim8YgudRksQc3w4cE2m0hPPHfE1BRd5lh1NpedrixMQ==} dependencies: - '@azure/msal-node': 2.4.0 + '@azure/msal-node': 2.6.3 '@xboxreplay/xboxlive-auth': 3.3.3(debug@4.3.4) debug: 4.3.4(supports-color@8.1.1) jose: 4.15.4 @@ -11895,13 +12045,13 @@ packages: - encoding - supports-color - /prismarine-biome@1.3.0(minecraft-data@3.60.0)(prismarine-registry@1.7.0): + /prismarine-biome@1.3.0(minecraft-data@3.61.2)(prismarine-registry@1.7.0): resolution: {integrity: sha512-GY6nZxq93mTErT7jD7jt8YS1aPrOakbJHh39seYsJFXvueIOdHAmW16kYQVrTVMW5MlWLQVxV/EquRwOgr4MnQ==} peerDependencies: - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 prismarine-registry: ^1.1.0 dependencies: - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 prismarine-registry: 1.7.0 /prismarine-chat@1.9.1: @@ -11912,11 +12062,11 @@ packages: prismarine-nbt: 2.5.0 prismarine-registry: 1.7.0 - /prismarine-chunk@1.35.0(minecraft-data@3.60.0): + /prismarine-chunk@1.35.0(minecraft-data@3.61.2): resolution: {integrity: sha512-Q1lElMUle7wWxWdQjbZo3j2/dLNG325j90IcbbMmBTnHdQSWIjWFe792XOz3RVBlvrhRJEiZk38S6/eQTQ9esw==} engines: {node: '>=14'} dependencies: - prismarine-biome: 1.3.0(minecraft-data@3.60.0)(prismarine-registry@1.7.0) + prismarine-biome: 1.3.0(minecraft-data@3.61.2)(prismarine-registry@1.7.0) prismarine-block: github.com/zardoy/prismarine-block/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-nbt: 2.2.1 prismarine-registry: 1.7.0 @@ -11954,7 +12104,7 @@ packages: /prismarine-physics@1.8.0: resolution: {integrity: sha512-gbM+S+bmVtOKVv+Z0WGaHMeEeBHISIDsRDRlv8sr0dex3ZJRhuq8djA02CBreguXtI18ZKh6q3TSj2qDr45NHA==} dependencies: - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 prismarine-nbt: 2.5.0 vec3: 0.1.8 dev: true @@ -11979,13 +12129,13 @@ packages: /prismarine-registry@1.7.0: resolution: {integrity: sha512-yyva0FpWI078nNeMhx8ekVza5uUTYhEv+C+ADu3wUQXiG8qhXkvrf0uzsnhTgZL8BLdsi2axgCEiKw9qSKIuxQ==} dependencies: - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 prismarine-nbt: 2.5.0 /prismarine-schematic@1.2.3: resolution: {integrity: sha512-Mwpn43vEHhm3aw3cPhJjWqztkW+nX+QLajDHlTask8lEOTGl1WmpvFja4iwiws4GIvaC8x0Foptf4uvDsnjrAg==} dependencies: - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 prismarine-block: github.com/zardoy/prismarine-block/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-nbt: 2.2.1 prismarine-world: github.com/zardoy/prismarine-world/c358222204d21fe7d45379fbfcefb047f926c786 @@ -12580,8 +12730,8 @@ packages: string_decoder: 1.3.0 util-deprecate: 1.0.2 - /readable-stream@4.4.2: - resolution: {integrity: sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==} + /readable-stream@4.5.2: + resolution: {integrity: sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: abort-controller: 3.0.0 @@ -12630,14 +12780,15 @@ packages: strip-indent: 4.0.0 dev: true - /reflect.getprototypeof@1.0.4: - resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} + /reflect.getprototypeof@1.0.5: + resolution: {integrity: sha512-62wgfC8dJWrmxv44CA36pLDnP6KKl3Vhxb7PL+8+qrrFMMoJij4vgiMP8zV4O8+CBMXY1mHxI5fITGHXFHVmQQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 + es-abstract: 1.22.4 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 globalthis: 1.0.3 which-builtin-type: 1.1.3 dev: true @@ -12676,6 +12827,16 @@ packages: define-properties: 1.2.1 set-function-name: 2.0.1 + /regexp.prototype.flags@1.5.2: + resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-errors: 1.3.0 + set-function-name: 2.0.1 + dev: true + /regexpp@3.2.0: resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} engines: {node: '>=8'} @@ -12888,6 +13049,16 @@ packages: has-symbols: 1.0.3 isarray: 2.0.5 + /safe-array-concat@1.1.0: + resolution: {integrity: sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==} + engines: {node: '>=0.4'} + dependencies: + call-bind: 1.0.7 + get-intrinsic: 1.2.4 + has-symbols: 1.0.3 + isarray: 2.0.5 + dev: true + /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} @@ -12901,6 +13072,15 @@ packages: get-intrinsic: 1.2.1 is-regex: 1.1.4 + /safe-regex-test@1.0.3: + resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-regex: 1.1.4 + dev: true + /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -12952,6 +13132,13 @@ packages: dependencies: lru-cache: 6.0.0 + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -13001,14 +13188,16 @@ packages: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} dev: false - /set-function-length@1.1.1: - resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} + /set-function-length@1.2.1: + resolution: {integrity: sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==} engines: {node: '>= 0.4'} dependencies: - define-data-property: 1.1.1 - get-intrinsic: 1.2.2 + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.4 gopd: 1.0.1 - has-property-descriptors: 1.0.1 + has-property-descriptors: 1.0.2 dev: true /set-function-name@2.0.1: @@ -13093,6 +13282,16 @@ packages: get-intrinsic: 1.2.1 object-inspect: 1.12.3 + /side-channel@1.0.5: + resolution: {integrity: sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 + object-inspect: 1.13.1 + dev: true + /siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} dev: true @@ -13655,8 +13854,8 @@ packages: resolution: {integrity: sha512-AsS729u2RHUfEra9xJrE39peJcc2stq2+poBXX8bcM08Y6g9j/i/PUzwNQqkaJde7Ntg1TO7bSREbR5sdosQ+g==} dev: true - /systeminformation@5.21.22: - resolution: {integrity: sha512-gNHloAJSyS+sKWkwvmvozZ1eHrdVTEsynWMTY6lvLGBB70gflkBQFw8drXXr1oEXY84+Vr9tOOrN8xHZLJSycA==} + /systeminformation@5.21.24: + resolution: {integrity: sha512-xQada8ByGGFoRXJaUptGgddn3i7IjtSdqNdCKzB8xkzsM7pHnfLYBWxkPdGzhZ0Z/l+W1yo+aZQZ74d2isj8kw==} engines: {node: '>=8.0.0'} os: [darwin, linux, win32, freebsd, openbsd, netbsd, sunos, android] hasBin: true @@ -14037,6 +14236,15 @@ packages: get-intrinsic: 1.2.1 is-typed-array: 1.1.12 + /typed-array-buffer@1.0.1: + resolution: {integrity: sha512-RSqu1UEuSlrBhHTWC8O9FnPjOduNs4M7rJ4pRKoEjtx1zUNOPN2sSXHLDX+Y2WPbHIxbvg4JFo2DNAEfPIKWoQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-typed-array: 1.1.13 + dev: true + /typed-array-byte-length@1.0.0: resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} engines: {node: '>= 0.4'} @@ -14081,6 +14289,10 @@ packages: hasBin: true dev: true + /ua-parser-js@1.0.37: + resolution: {integrity: sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==} + dev: false + /ufo@1.3.1: resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} dev: true @@ -14481,8 +14693,8 @@ packages: optionalDependencies: fsevents: 2.3.3 - /vite@4.5.0: - resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} + /vite@4.5.2: + resolution: {integrity: sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -14510,7 +14722,7 @@ packages: optional: true dependencies: esbuild: 0.18.20 - postcss: 8.4.31 + postcss: 8.4.35 rollup: 3.29.4 optionalDependencies: fsevents: 2.3.3 @@ -14669,7 +14881,7 @@ packages: engines: {node: '>= 0.4'} dependencies: function.prototype.name: 1.1.6 - has-tostringtag: 1.0.0 + has-tostringtag: 1.0.2 is-async-function: 2.0.0 is-date-object: 1.0.5 is-finalizationregistry: 1.0.2 @@ -14679,7 +14891,7 @@ packages: isarray: 2.0.5 which-boxed-primitive: 1.0.2 which-collection: 1.0.1 - which-typed-array: 1.1.13 + which-typed-array: 1.1.14 dev: true /which-collection@1.0.1: @@ -14701,15 +14913,15 @@ packages: gopd: 1.0.1 has-tostringtag: 1.0.0 - /which-typed-array@1.1.13: - resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} + /which-typed-array@1.1.14: + resolution: {integrity: sha512-VnXFiIW8yNn9kIHN88xvZ4yOWchftKDsRJ8fEPacX/wl1lOvBrhsJ/OeJCXq7B0AaijRuqgzSKalJoPk+D8MPg==} engines: {node: '>= 0.4'} dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 + available-typed-arrays: 1.0.6 + call-bind: 1.0.7 for-each: 0.3.3 gopd: 1.0.1 - has-tostringtag: 1.0.0 + has-tostringtag: 1.0.2 dev: true /which@1.3.1: @@ -15127,18 +15339,18 @@ packages: react: 18.2.0 dev: false - github.com/PrismarineJS/mineflayer/cc98f1307e3ab48477d2a9ff29da4447f42b30bc: - resolution: {tarball: https://codeload.github.com/PrismarineJS/mineflayer/tar.gz/cc98f1307e3ab48477d2a9ff29da4447f42b30bc} + github.com/PrismarineJS/mineflayer/b9491ae508dc52e4538dd66eb6f47a639facde20: + resolution: {tarball: https://codeload.github.com/PrismarineJS/mineflayer/tar.gz/b9491ae508dc52e4538dd66eb6f47a639facde20} name: mineflayer - version: 4.18.0 + version: 4.19.0 engines: {node: '>=18'} dependencies: - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 minecraft-protocol: github.com/zardoy/minecraft-protocol/2c14a686bfe7cbd9a5c87b629b402295ee86219f - prismarine-biome: 1.3.0(minecraft-data@3.60.0)(prismarine-registry@1.7.0) + prismarine-biome: 1.3.0(minecraft-data@3.61.2)(prismarine-registry@1.7.0) prismarine-block: github.com/zardoy/prismarine-block/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-chat: 1.9.1 - prismarine-chunk: 1.35.0(minecraft-data@3.60.0) + prismarine-chunk: 1.35.0(minecraft-data@3.61.2) prismarine-entity: 2.3.1 prismarine-item: 1.14.0 prismarine-nbt: 2.2.1 @@ -15175,15 +15387,15 @@ packages: name: diamond-square version: 1.3.0 dependencies: - minecraft-data: 3.60.0 - prismarine-chunk: 1.35.0(minecraft-data@3.60.0) + minecraft-data: 3.61.2 + prismarine-chunk: 1.35.0(minecraft-data@3.61.2) random-seed: 0.3.0 vec3: 0.1.8 dev: false - github.com/zardoy/minecraft-inventory-gui/69003692b3041d94a420a65c7d3cc1b37737e838(@types/react@18.2.20)(react@18.2.0): - resolution: {tarball: https://codeload.github.com/zardoy/minecraft-inventory-gui/tar.gz/69003692b3041d94a420a65c7d3cc1b37737e838} - id: github.com/zardoy/minecraft-inventory-gui/69003692b3041d94a420a65c7d3cc1b37737e838 + github.com/zardoy/minecraft-inventory-gui/bf2e7ba3afdc606604d85682d081778281d533cb(@types/react@18.2.20)(react@18.2.0): + resolution: {tarball: https://codeload.github.com/zardoy/minecraft-inventory-gui/tar.gz/bf2e7ba3afdc606604d85682d081778281d533cb} + id: github.com/zardoy/minecraft-inventory-gui/bf2e7ba3afdc606604d85682d081778281d533cb name: minecraft-inventory-gui version: 1.0.1 dependencies: @@ -15199,22 +15411,22 @@ packages: version: 1.45.0 engines: {node: '>=14'} dependencies: - '@types/readable-stream': 4.0.4 + '@types/readable-stream': 4.0.10 aes-js: 3.1.2 buffer-equal: 1.0.1 debug: 4.3.4(supports-color@8.1.1) endian-toggle: 0.0.0 lodash.get: 4.4.2 lodash.merge: 4.6.2 - minecraft-data: 3.60.0 + minecraft-data: 3.61.2 minecraft-folder-path: 1.2.0 node-fetch: 2.7.0 node-rsa: 0.4.2 - prismarine-auth: 2.3.0 + prismarine-auth: 2.4.1 prismarine-nbt: 2.5.0 prismarine-realms: 1.3.2 protodef: 1.15.0 - readable-stream: 4.4.2 + readable-stream: 4.5.2 uuid-1345: 1.0.2 yggdrasil: 1.7.0 transitivePeerDependencies: @@ -15226,20 +15438,20 @@ packages: name: prismarine-block version: 1.17.1 dependencies: - minecraft-data: 3.60.0 - prismarine-biome: 1.3.0(minecraft-data@3.60.0)(prismarine-registry@1.7.0) + minecraft-data: 3.61.2 + prismarine-biome: 1.3.0(minecraft-data@3.61.2)(prismarine-registry@1.7.0) prismarine-chat: 1.9.1 prismarine-item: 1.14.0 prismarine-nbt: 2.2.1 prismarine-registry: 1.7.0 - github.com/zardoy/prismarine-provider-anvil/0ddcd9d48574113308e1fbebef60816aced0846f(minecraft-data@3.60.0): + github.com/zardoy/prismarine-provider-anvil/0ddcd9d48574113308e1fbebef60816aced0846f(minecraft-data@3.61.2): resolution: {tarball: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/0ddcd9d48574113308e1fbebef60816aced0846f} id: github.com/zardoy/prismarine-provider-anvil/0ddcd9d48574113308e1fbebef60816aced0846f name: prismarine-provider-anvil version: 2.7.0 dependencies: - prismarine-chunk: 1.35.0(minecraft-data@3.60.0) + prismarine-chunk: 1.35.0(minecraft-data@3.61.2) prismarine-nbt: 2.5.0 uint4: 0.1.2 vec3: 0.1.8 diff --git a/prismarine-viewer/viewer/lib/entities.js b/prismarine-viewer/viewer/lib/entities.js index a3c797b8..422f8ed9 100644 --- a/prismarine-viewer/viewer/lib/entities.js +++ b/prismarine-viewer/viewer/lib/entities.js @@ -11,7 +11,8 @@ import { loadSkinToCanvas, loadEarsToCanvasFromSkin, inferModelType, loadCapeToC import stevePng from 'minecraft-assets/minecraft-assets/data/1.20.2/entity/player/wide/steve.png' import { WalkingGeneralSwing } from './entity/animations' import { NameTagObject } from 'skinview3d/libs/nametag' -import { fromFormattedString } from '@xmcl/text-component' +import { flat, fromFormattedString } from '@xmcl/text-component' +import mojangson from 'mojangson' export const TWEEN_DURATION = 50 // todo should be 100 @@ -39,6 +40,23 @@ function getUsernameTexture (username, { fontFamily = 'sans-serif' }) { return canvas } +const addNametag = (entity, options, mesh) => { + if (entity.username !== undefined) { + if (mesh.children.find(c => c.name === 'nametag')) return // todo update + const canvas = getUsernameTexture(entity.username, options) + const tex = new THREE.Texture(canvas) + tex.needsUpdate = true + const spriteMat = new THREE.SpriteMaterial({ map: tex }) + const sprite = new THREE.Sprite(spriteMat) + sprite.renderOrder = 1000 + sprite.scale.set(canvas.width * 0.005, canvas.height * 0.005, 1) + sprite.position.y += entity.height + 0.6 + sprite.name = 'nametag' + + mesh.add(sprite) + } +} + function getEntityMesh (entity, scene, options, overrides) { if (entity.name) { try { @@ -46,18 +64,7 @@ function getEntityMesh (entity, scene, options, overrides) { const entityName = entity.name.toLowerCase() const e = new Entity('1.16.4', entityName, scene, overrides) - if (entity.username !== undefined) { - const canvas = getUsernameTexture(entity.username, options) - const tex = new THREE.Texture(canvas) - tex.needsUpdate = true - const spriteMat = new THREE.SpriteMaterial({ map: tex }) - const sprite = new THREE.Sprite(spriteMat) - sprite.renderOrder = 1000 - sprite.scale.set(canvas.width * 0.005, canvas.height * 0.005, 1) - sprite.position.y += entity.height + 0.6 - - e.mesh.add(sprite) - } + addNametag(entity, options, e.mesh) return e.mesh } catch (err) { console.log(err) @@ -126,6 +133,9 @@ export class Entities extends EventEmitter { return playerObject } + // fixme workaround + defaultSteveTexture + // true means use default skin url updatePlayerSkin (entityId, username, /** @type {string | true} */skinUrl, /** @type {string | true | undefined} */capeUrl = undefined) { let playerObject = this.getPlayerObject(entityId) @@ -139,15 +149,24 @@ export class Entities extends EventEmitter { loadImage(skinUrl).then((image) => { playerObject = this.getPlayerObject(entityId) if (!playerObject) return - const skinCanvas = document.createElement('canvas') - loadSkinToCanvas(skinCanvas, image) - const skinTexture = new THREE.CanvasTexture(skinCanvas) + /** @type {THREE.CanvasTexture} */ + let skinTexture + if (skinUrl === stevePng && this.defaultSteveTexture) { + skinTexture = this.defaultSteveTexture + } else { + const skinCanvas = document.createElement('canvas') + loadSkinToCanvas(skinCanvas, image) + skinTexture = new THREE.CanvasTexture(skinCanvas) + if (skinUrl === stevePng) { + this.defaultSteveTexture = skinTexture + } + } skinTexture.magFilter = THREE.NearestFilter skinTexture.minFilter = THREE.NearestFilter skinTexture.needsUpdate = true //@ts-ignore playerObject.skin.map = skinTexture - playerObject.skin.modelType = inferModelType(skinCanvas) + playerObject.skin.modelType = inferModelType(skinTexture.image) const earsCanvas = document.createElement('canvas') loadEarsToCanvasFromSkin(earsCanvas, image) @@ -186,9 +205,9 @@ export class Entities extends EventEmitter { if (!playerObject.backEquipment) { playerObject.backEquipment = 'cape' } - }) + }, () => {}) } - }) + }, () => {}) playerObject.cape.visible = false @@ -228,6 +247,13 @@ export class Entities extends EventEmitter { } + displaySimpleText (jsonLike) { + if (!jsonLike) return + const parsed = mojangson.simplify(mojangson.parse(jsonLike)) + const text = flat(parsed).map(x => x.text) + return text.join('') + } + update (/** @type {import('prismarine-entity').Entity & {delete?, pos}} */entity, overrides) { if (!this.entities[entity.id] && !entity.delete) { const group = new THREE.Group() @@ -295,6 +321,48 @@ export class Entities extends EventEmitter { this.setVisible(this.visible, group) } + //@ts-ignore + const isInvisible = entity.metadata?.[0] & 0x20 + if (isInvisible) { + for (const child of this.entities[entity.id].children.find(c => c.name === 'mesh').children) { + if (child.name !== 'nametag') { + child.visible = false + } + } + } + // not player + const displayText = entity.metadata?.[3] && this.displaySimpleText(entity.metadata[2]); + if (entity.name !== 'player' && displayText) { + addNametag({ ...entity, username: displayText }, this.entitiesOptions, this.entities[entity.id].children.find(c => c.name === 'mesh')) + } + + // todo handle map, map_chunks events + // if (entity.name === 'item_frame' || entity.name === 'glow_item_frame') { + // const example = { + // "present": true, + // "itemId": 847, + // "itemCount": 1, + // "nbtData": { + // "type": "compound", + // "name": "", + // "value": { + // "map": { + // "type": "int", + // "value": 2146483444 + // }, + // "interactiveboard": { + // "type": "byte", + // "value": 1 + // } + // } + // } + // } + // const item = entity.metadata?.[8] + // if (item.nbtData) { + // const nbt = nbt.simplify(item.nbtData) + // } + // } + // this can be undefined in case where packet entity_destroy was sent twice (so it was already deleted) const e = this.entities[entity.id] diff --git a/prismarine-viewer/viewer/lib/moreBlockDataGenerated.json b/prismarine-viewer/viewer/lib/moreBlockDataGenerated.json index 152d1f83..a2ca2087 100644 --- a/prismarine-viewer/viewer/lib/moreBlockDataGenerated.json +++ b/prismarine-viewer/viewer/lib/moreBlockDataGenerated.json @@ -179,5 +179,536 @@ "flowering_azalea": true, "frogspawn": true, "decorated_pot": true + }, + "colors": { + "stone": "rgb(112, 112, 112)", + "granite": "rgb(151, 109, 77)", + "polished_granite": "rgb(151, 109, 77)", + "diorite": "rgb(255, 252, 245)", + "polished_diorite": "rgb(255, 252, 245)", + "andesite": "rgb(112, 112, 112)", + "polished_andesite": "rgb(112, 112, 112)", + "grass_block": "rgb(127, 178, 56)", + "dirt": "rgb(151, 109, 77)", + "coarse_dirt": "rgb(151, 109, 77)", + "podzol": "rgb(129, 86, 49)", + "cobblestone": "rgb(112, 112, 112)", + "oak_planks": "rgb(143, 119, 72)", + "spruce_planks": "rgb(129, 86, 49)", + "birch_planks": "rgb(247, 233, 163)", + "jungle_planks": "rgb(151, 109, 77)", + "acacia_planks": "rgb(216, 127, 51)", + "cherry_planks": "rgb(209, 177, 161)", + "dark_oak_planks": "rgb(102, 76, 51)", + "mangrove_planks": "rgb(153, 51, 51)", + "bamboo_planks": "rgb(229, 229, 51)", + "bamboo_mosaic": "rgb(229, 229, 51)", + "oak_sapling": "rgb(0, 124, 0)", + "spruce_sapling": "rgb(0, 124, 0)", + "birch_sapling": "rgb(0, 124, 0)", + "jungle_sapling": "rgb(0, 124, 0)", + "acacia_sapling": "rgb(0, 124, 0)", + "cherry_sapling": "rgb(242, 127, 165)", + "dark_oak_sapling": "rgb(0, 124, 0)", + "mangrove_propagule": "rgb(0, 124, 0)", + "bedrock": "rgb(112, 112, 112)", + "water": "rgb(64, 64, 255)", + "lava": "rgb(255, 0, 0)", + "sand": "rgb(247, 233, 163)", + "suspicious_sand": "rgb(247, 233, 163)", + "red_sand": "rgb(216, 127, 51)", + "gravel": "rgb(112, 112, 112)", + "suspicious_gravel": "rgb(112, 112, 112)", + "gold_ore": "rgb(112, 112, 112)", + "deepslate_gold_ore": "rgb(100, 100, 100)", + "iron_ore": "rgb(112, 112, 112)", + "deepslate_iron_ore": "rgb(100, 100, 100)", + "coal_ore": "rgb(112, 112, 112)", + "deepslate_coal_ore": "rgb(100, 100, 100)", + "nether_gold_ore": "rgb(112, 2, 0)", + "mangrove_roots": "rgb(129, 86, 49)", + "muddy_mangrove_roots": "rgb(129, 86, 49)", + "oak_wood": "rgb(143, 119, 72)", + "spruce_wood": "rgb(129, 86, 49)", + "birch_wood": "rgb(247, 233, 163)", + "jungle_wood": "rgb(151, 109, 77)", + "acacia_wood": "rgb(76, 76, 76)", + "cherry_wood": "rgb(57, 41, 35)", + "dark_oak_wood": "rgb(102, 76, 51)", + "mangrove_wood": "rgb(153, 51, 51)", + "stripped_oak_wood": "rgb(143, 119, 72)", + "stripped_spruce_wood": "rgb(129, 86, 49)", + "stripped_birch_wood": "rgb(247, 233, 163)", + "stripped_jungle_wood": "rgb(151, 109, 77)", + "stripped_acacia_wood": "rgb(216, 127, 51)", + "stripped_cherry_wood": "rgb(160, 77, 78)", + "stripped_dark_oak_wood": "rgb(102, 76, 51)", + "oak_leaves": "rgb(0, 124, 0)", + "spruce_leaves": "rgb(0, 124, 0)", + "birch_leaves": "rgb(0, 124, 0)", + "jungle_leaves": "rgb(0, 124, 0)", + "acacia_leaves": "rgb(0, 124, 0)", + "cherry_leaves": "rgb(242, 127, 165)", + "dark_oak_leaves": "rgb(0, 124, 0)", + "mangrove_leaves": "rgb(0, 124, 0)", + "azalea_leaves": "rgb(0, 124, 0)", + "flowering_azalea_leaves": "rgb(0, 124, 0)", + "sponge": "rgb(229, 229, 51)", + "wet_sponge": "rgb(229, 229, 51)", + "lapis_ore": "rgb(112, 112, 112)", + "deepslate_lapis_ore": "rgb(100, 100, 100)", + "lapis_block": "rgb(74, 128, 255)", + "dispenser": "rgb(112, 112, 112)", + "sandstone": "rgb(247, 233, 163)", + "chiseled_sandstone": "rgb(247, 233, 163)", + "cut_sandstone": "rgb(247, 233, 163)", + "note_block": "rgb(143, 119, 72)", + "sticky_piston": "rgb(112, 112, 112)", + "cobweb": "rgb(199, 199, 199)", + "grass": "rgb(0, 124, 0)", + "fern": "rgb(0, 124, 0)", + "dead_bush": "rgb(143, 119, 72)", + "seagrass": "rgb(64, 64, 255)", + "tall_seagrass": "rgb(64, 64, 255)", + "piston": "rgb(112, 112, 112)", + "piston_head": "rgb(112, 112, 112)", + "white_wool": "rgb(255, 255, 255)", + "orange_wool": "rgb(216, 127, 51)", + "magenta_wool": "rgb(178, 76, 216)", + "light_blue_wool": "rgb(102, 153, 216)", + "yellow_wool": "rgb(229, 229, 51)", + "lime_wool": "rgb(127, 204, 25)", + "pink_wool": "rgb(242, 127, 165)", + "gray_wool": "rgb(76, 76, 76)", + "light_gray_wool": "rgb(153, 153, 153)", + "cyan_wool": "rgb(76, 127, 153)", + "purple_wool": "rgb(127, 63, 178)", + "blue_wool": "rgb(51, 76, 178)", + "brown_wool": "rgb(102, 76, 51)", + "green_wool": "rgb(102, 127, 51)", + "red_wool": "rgb(153, 51, 51)", + "black_wool": "rgb(25, 25, 25)", + "moving_piston": "rgb(112, 112, 112)", + "dandelion": "rgb(0, 124, 0)", + "torchflower": "rgb(0, 124, 0)", + "poppy": "rgb(0, 124, 0)", + "blue_orchid": "rgb(0, 124, 0)", + "allium": "rgb(0, 124, 0)", + "azure_bluet": "rgb(0, 124, 0)", + "red_tulip": "rgb(0, 124, 0)", + "orange_tulip": "rgb(0, 124, 0)", + "white_tulip": "rgb(0, 124, 0)", + "pink_tulip": "rgb(0, 124, 0)", + "oxeye_daisy": "rgb(0, 124, 0)", + "cornflower": "rgb(0, 124, 0)", + "wither_rose": "rgb(0, 124, 0)", + "lily_of_the_valley": "rgb(0, 124, 0)", + "brown_mushroom": "rgb(102, 76, 51)", + "red_mushroom": "rgb(153, 51, 51)", + "gold_block": "rgb(250, 238, 77)", + "iron_block": "rgb(167, 167, 167)", + "bricks": "rgb(153, 51, 51)", + "tnt": "rgb(255, 0, 0)", + "bookshelf": "rgb(143, 119, 72)", + "chiseled_bookshelf": "rgb(143, 119, 72)", + "mossy_cobblestone": "rgb(112, 112, 112)", + "obsidian": "rgb(25, 25, 25)", + "fire": "rgb(255, 0, 0)", + "soul_fire": "rgb(102, 153, 216)", + "spawner": "rgb(112, 112, 112)", + "chest": "rgb(143, 119, 72)", + "diamond_ore": "rgb(112, 112, 112)", + "deepslate_diamond_ore": "rgb(100, 100, 100)", + "diamond_block": "rgb(92, 219, 213)", + "crafting_table": "rgb(143, 119, 72)", + "wheat": "rgb(0, 124, 0)", + "farmland": "rgb(151, 109, 77)", + "furnace": "rgb(112, 112, 112)", + "oak_sign": "rgb(143, 119, 72)", + "birch_sign": "rgb(247, 233, 163)", + "acacia_sign": "rgb(216, 127, 51)", + "oak_wall_sign": "rgb(143, 119, 72)", + "birch_wall_sign": "rgb(247, 233, 163)", + "acacia_wall_sign": "rgb(216, 127, 51)", + "birch_hanging_sign": "rgb(247, 233, 163)", + "acacia_hanging_sign": "rgb(216, 127, 51)", + "cherry_hanging_sign": "rgb(160, 77, 78)", + "crimson_hanging_sign": "rgb(148, 63, 97)", + "warped_hanging_sign": "rgb(58, 142, 140)", + "bamboo_hanging_sign": "rgb(229, 229, 51)", + "spruce_wall_hanging_sign": "rgb(143, 119, 72)", + "birch_wall_hanging_sign": "rgb(247, 233, 163)", + "acacia_wall_hanging_sign": "rgb(216, 127, 51)", + "cherry_wall_hanging_sign": "rgb(160, 77, 78)", + "crimson_wall_hanging_sign": "rgb(148, 63, 97)", + "warped_wall_hanging_sign": "rgb(58, 142, 140)", + "bamboo_wall_hanging_sign": "rgb(229, 229, 51)", + "stone_pressure_plate": "rgb(112, 112, 112)", + "iron_door": "rgb(167, 167, 167)", + "redstone_ore": "rgb(112, 112, 112)", + "deepslate_redstone_ore": "rgb(100, 100, 100)", + "snow": "rgb(255, 255, 255)", + "ice": "rgb(160, 160, 255)", + "snow_block": "rgb(255, 255, 255)", + "cactus": "rgb(0, 124, 0)", + "clay": "rgb(164, 168, 184)", + "sugar_cane": "rgb(0, 124, 0)", + "jukebox": "rgb(151, 109, 77)", + "pumpkin": "rgb(216, 127, 51)", + "netherrack": "rgb(112, 2, 0)", + "soul_sand": "rgb(102, 76, 51)", + "soul_soil": "rgb(102, 76, 51)", + "basalt": "rgb(25, 25, 25)", + "polished_basalt": "rgb(25, 25, 25)", + "glowstone": "rgb(247, 233, 163)", + "carved_pumpkin": "rgb(216, 127, 51)", + "jack_o_lantern": "rgb(216, 127, 51)", + "oak_trapdoor": "rgb(143, 119, 72)", + "spruce_trapdoor": "rgb(129, 86, 49)", + "birch_trapdoor": "rgb(247, 233, 163)", + "jungle_trapdoor": "rgb(151, 109, 77)", + "acacia_trapdoor": "rgb(216, 127, 51)", + "cherry_trapdoor": "rgb(209, 177, 161)", + "dark_oak_trapdoor": "rgb(102, 76, 51)", + "mangrove_trapdoor": "rgb(153, 51, 51)", + "bamboo_trapdoor": "rgb(229, 229, 51)", + "stone_bricks": "rgb(112, 112, 112)", + "mossy_stone_bricks": "rgb(112, 112, 112)", + "cracked_stone_bricks": "rgb(112, 112, 112)", + "chiseled_stone_bricks": "rgb(112, 112, 112)", + "mud_bricks": "rgb(135, 107, 98)", + "infested_stone": "rgb(164, 168, 184)", + "infested_cobblestone": "rgb(164, 168, 184)", + "infested_stone_bricks": "rgb(164, 168, 184)", + "infested_mossy_stone_bricks": "rgb(164, 168, 184)", + "infested_cracked_stone_bricks": "rgb(164, 168, 184)", + "infested_chiseled_stone_bricks": "rgb(164, 168, 184)", + "brown_mushroom_block": "rgb(151, 109, 77)", + "red_mushroom_block": "rgb(153, 51, 51)", + "mushroom_stem": "rgb(199, 199, 199)", + "melon": "rgb(127, 204, 25)", + "attached_pumpkin_stem": "rgb(0, 124, 0)", + "attached_melon_stem": "rgb(0, 124, 0)", + "pumpkin_stem": "rgb(0, 124, 0)", + "melon_stem": "rgb(0, 124, 0)", + "vine": "rgb(0, 124, 0)", + "glow_lichen": "rgb(127, 167, 150)", + "mycelium": "rgb(127, 63, 178)", + "lily_pad": "rgb(0, 124, 0)", + "nether_bricks": "rgb(112, 2, 0)", + "nether_brick_fence": "rgb(112, 2, 0)", + "nether_wart": "rgb(153, 51, 51)", + "enchanting_table": "rgb(153, 51, 51)", + "brewing_stand": "rgb(167, 167, 167)", + "cauldron": "rgb(112, 112, 112)", + "end_portal": "rgb(25, 25, 25)", + "end_portal_frame": "rgb(102, 127, 51)", + "end_stone": "rgb(247, 233, 163)", + "dragon_egg": "rgb(25, 25, 25)", + "cocoa": "rgb(0, 124, 0)", + "emerald_ore": "rgb(112, 112, 112)", + "deepslate_emerald_ore": "rgb(100, 100, 100)", + "ender_chest": "rgb(112, 112, 112)", + "emerald_block": "rgb(0, 217, 58)", + "command_block": "rgb(102, 76, 51)", + "beacon": "rgb(92, 219, 213)", + "carrots": "rgb(0, 124, 0)", + "potatoes": "rgb(0, 124, 0)", + "anvil": "rgb(167, 167, 167)", + "chipped_anvil": "rgb(167, 167, 167)", + "damaged_anvil": "rgb(167, 167, 167)", + "trapped_chest": "rgb(143, 119, 72)", + "light_weighted_pressure_plate": "rgb(250, 238, 77)", + "heavy_weighted_pressure_plate": "rgb(167, 167, 167)", + "daylight_detector": "rgb(143, 119, 72)", + "redstone_block": "rgb(255, 0, 0)", + "nether_quartz_ore": "rgb(112, 2, 0)", + "hopper": "rgb(112, 112, 112)", + "quartz_block": "rgb(255, 252, 245)", + "chiseled_quartz_block": "rgb(255, 252, 245)", + "quartz_pillar": "rgb(255, 252, 245)", + "dropper": "rgb(112, 112, 112)", + "white_terracotta": "rgb(209, 177, 161)", + "orange_terracotta": "rgb(159, 82, 36)", + "magenta_terracotta": "rgb(149, 87, 108)", + "light_blue_terracotta": "rgb(112, 108, 138)", + "yellow_terracotta": "rgb(186, 133, 36)", + "lime_terracotta": "rgb(103, 117, 53)", + "pink_terracotta": "rgb(160, 77, 78)", + "gray_terracotta": "rgb(57, 41, 35)", + "light_gray_terracotta": "rgb(135, 107, 98)", + "cyan_terracotta": "rgb(87, 92, 92)", + "purple_terracotta": "rgb(122, 73, 88)", + "blue_terracotta": "rgb(76, 62, 92)", + "brown_terracotta": "rgb(76, 50, 35)", + "green_terracotta": "rgb(76, 82, 42)", + "red_terracotta": "rgb(142, 60, 46)", + "black_terracotta": "rgb(37, 22, 16)", + "slime_block": "rgb(127, 178, 56)", + "iron_trapdoor": "rgb(167, 167, 167)", + "prismarine": "rgb(76, 127, 153)", + "prismarine_bricks": "rgb(92, 219, 213)", + "dark_prismarine": "rgb(92, 219, 213)", + "prismarine_slab": "rgb(76, 127, 153)", + "prismarine_brick_slab": "rgb(92, 219, 213)", + "dark_prismarine_slab": "rgb(92, 219, 213)", + "sea_lantern": "rgb(255, 252, 245)", + "hay_block": "rgb(229, 229, 51)", + "white_carpet": "rgb(255, 255, 255)", + "orange_carpet": "rgb(216, 127, 51)", + "magenta_carpet": "rgb(178, 76, 216)", + "light_blue_carpet": "rgb(102, 153, 216)", + "yellow_carpet": "rgb(229, 229, 51)", + "lime_carpet": "rgb(127, 204, 25)", + "pink_carpet": "rgb(242, 127, 165)", + "gray_carpet": "rgb(76, 76, 76)", + "light_gray_carpet": "rgb(153, 153, 153)", + "cyan_carpet": "rgb(76, 127, 153)", + "purple_carpet": "rgb(127, 63, 178)", + "blue_carpet": "rgb(51, 76, 178)", + "brown_carpet": "rgb(102, 76, 51)", + "green_carpet": "rgb(102, 127, 51)", + "red_carpet": "rgb(153, 51, 51)", + "black_carpet": "rgb(25, 25, 25)", + "terracotta": "rgb(216, 127, 51)", + "coal_block": "rgb(25, 25, 25)", + "packed_ice": "rgb(160, 160, 255)", + "sunflower": "rgb(0, 124, 0)", + "lilac": "rgb(0, 124, 0)", + "rose_bush": "rgb(0, 124, 0)", + "peony": "rgb(0, 124, 0)", + "tall_grass": "rgb(0, 124, 0)", + "large_fern": "rgb(0, 124, 0)", + "white_banner": "rgb(143, 119, 72)", + "orange_banner": "rgb(143, 119, 72)", + "magenta_banner": "rgb(143, 119, 72)", + "light_blue_banner": "rgb(143, 119, 72)", + "yellow_banner": "rgb(143, 119, 72)", + "lime_banner": "rgb(143, 119, 72)", + "pink_banner": "rgb(143, 119, 72)", + "gray_banner": "rgb(143, 119, 72)", + "light_gray_banner": "rgb(143, 119, 72)", + "cyan_banner": "rgb(143, 119, 72)", + "purple_banner": "rgb(143, 119, 72)", + "blue_banner": "rgb(143, 119, 72)", + "brown_banner": "rgb(143, 119, 72)", + "green_banner": "rgb(143, 119, 72)", + "red_banner": "rgb(143, 119, 72)", + "black_banner": "rgb(143, 119, 72)", + "white_wall_banner": "rgb(143, 119, 72)", + "orange_wall_banner": "rgb(143, 119, 72)", + "magenta_wall_banner": "rgb(143, 119, 72)", + "light_blue_wall_banner": "rgb(143, 119, 72)", + "yellow_wall_banner": "rgb(143, 119, 72)", + "lime_wall_banner": "rgb(143, 119, 72)", + "pink_wall_banner": "rgb(143, 119, 72)", + "gray_wall_banner": "rgb(143, 119, 72)", + "light_gray_wall_banner": "rgb(143, 119, 72)", + "cyan_wall_banner": "rgb(143, 119, 72)", + "purple_wall_banner": "rgb(143, 119, 72)", + "blue_wall_banner": "rgb(143, 119, 72)", + "brown_wall_banner": "rgb(143, 119, 72)", + "green_wall_banner": "rgb(143, 119, 72)", + "red_wall_banner": "rgb(143, 119, 72)", + "black_wall_banner": "rgb(143, 119, 72)", + "red_sandstone": "rgb(216, 127, 51)", + "chiseled_red_sandstone": "rgb(216, 127, 51)", + "cut_red_sandstone": "rgb(216, 127, 51)", + "oak_slab": "rgb(143, 119, 72)", + "spruce_slab": "rgb(129, 86, 49)", + "birch_slab": "rgb(247, 233, 163)", + "jungle_slab": "rgb(151, 109, 77)", + "acacia_slab": "rgb(216, 127, 51)", + "cherry_slab": "rgb(209, 177, 161)", + "dark_oak_slab": "rgb(102, 76, 51)", + "mangrove_slab": "rgb(153, 51, 51)", + "bamboo_slab": "rgb(229, 229, 51)", + "bamboo_mosaic_slab": "rgb(229, 229, 51)", + "stone_slab": "rgb(112, 112, 112)", + "smooth_stone_slab": "rgb(112, 112, 112)", + "sandstone_slab": "rgb(247, 233, 163)", + "cut_sandstone_slab": "rgb(247, 233, 163)", + "petrified_oak_slab": "rgb(143, 119, 72)", + "cobblestone_slab": "rgb(112, 112, 112)", + "brick_slab": "rgb(153, 51, 51)", + "stone_brick_slab": "rgb(112, 112, 112)", + "mud_brick_slab": "rgb(135, 107, 98)", + "nether_brick_slab": "rgb(112, 2, 0)", + "quartz_slab": "rgb(255, 252, 245)", + "red_sandstone_slab": "rgb(216, 127, 51)", + "cut_red_sandstone_slab": "rgb(216, 127, 51)", + "purpur_slab": "rgb(178, 76, 216)", + "smooth_stone": "rgb(112, 112, 112)", + "smooth_sandstone": "rgb(247, 233, 163)", + "smooth_quartz": "rgb(255, 252, 245)", + "smooth_red_sandstone": "rgb(216, 127, 51)", + "chorus_plant": "rgb(127, 63, 178)", + "chorus_flower": "rgb(127, 63, 178)", + "purpur_block": "rgb(178, 76, 216)", + "purpur_pillar": "rgb(178, 76, 216)", + "end_stone_bricks": "rgb(247, 233, 163)", + "torchflower_crop": "rgb(0, 124, 0)", + "pitcher_crop": "rgb(0, 124, 0)", + "pitcher_plant": "rgb(0, 124, 0)", + "beetroots": "rgb(0, 124, 0)", + "dirt_path": "rgb(151, 109, 77)", + "end_gateway": "rgb(25, 25, 25)", + "repeating_command_block": "rgb(127, 63, 178)", + "chain_command_block": "rgb(102, 127, 51)", + "frosted_ice": "rgb(160, 160, 255)", + "magma_block": "rgb(112, 2, 0)", + "nether_wart_block": "rgb(153, 51, 51)", + "red_nether_bricks": "rgb(112, 2, 0)", + "bone_block": "rgb(247, 233, 163)", + "observer": "rgb(112, 112, 112)", + "kelp": "rgb(64, 64, 255)", + "kelp_plant": "rgb(64, 64, 255)", + "dried_kelp_block": "rgb(102, 127, 51)", + "turtle_egg": "rgb(247, 233, 163)", + "sniffer_egg": "rgb(153, 51, 51)", + "dead_tube_coral_block": "rgb(76, 76, 76)", + "dead_brain_coral_block": "rgb(76, 76, 76)", + "dead_bubble_coral_block": "rgb(76, 76, 76)", + "dead_fire_coral_block": "rgb(76, 76, 76)", + "dead_horn_coral_block": "rgb(76, 76, 76)", + "tube_coral_block": "rgb(51, 76, 178)", + "brain_coral_block": "rgb(242, 127, 165)", + "bubble_coral_block": "rgb(127, 63, 178)", + "fire_coral_block": "rgb(153, 51, 51)", + "horn_coral_block": "rgb(229, 229, 51)", + "dead_tube_coral": "rgb(76, 76, 76)", + "dead_brain_coral": "rgb(76, 76, 76)", + "dead_bubble_coral": "rgb(76, 76, 76)", + "dead_fire_coral": "rgb(76, 76, 76)", + "dead_horn_coral": "rgb(76, 76, 76)", + "tube_coral": "rgb(51, 76, 178)", + "brain_coral": "rgb(242, 127, 165)", + "bubble_coral": "rgb(127, 63, 178)", + "fire_coral": "rgb(153, 51, 51)", + "horn_coral": "rgb(229, 229, 51)", + "dead_tube_coral_fan": "rgb(76, 76, 76)", + "dead_brain_coral_fan": "rgb(76, 76, 76)", + "dead_bubble_coral_fan": "rgb(76, 76, 76)", + "dead_fire_coral_fan": "rgb(76, 76, 76)", + "dead_horn_coral_fan": "rgb(76, 76, 76)", + "tube_coral_fan": "rgb(51, 76, 178)", + "brain_coral_fan": "rgb(242, 127, 165)", + "bubble_coral_fan": "rgb(127, 63, 178)", + "fire_coral_fan": "rgb(153, 51, 51)", + "horn_coral_fan": "rgb(229, 229, 51)", + "dead_tube_coral_wall_fan": "rgb(76, 76, 76)", + "dead_brain_coral_wall_fan": "rgb(76, 76, 76)", + "dead_bubble_coral_wall_fan": "rgb(76, 76, 76)", + "dead_fire_coral_wall_fan": "rgb(76, 76, 76)", + "dead_horn_coral_wall_fan": "rgb(76, 76, 76)", + "tube_coral_wall_fan": "rgb(51, 76, 178)", + "brain_coral_wall_fan": "rgb(242, 127, 165)", + "bubble_coral_wall_fan": "rgb(127, 63, 178)", + "fire_coral_wall_fan": "rgb(153, 51, 51)", + "horn_coral_wall_fan": "rgb(229, 229, 51)", + "sea_pickle": "rgb(102, 127, 51)", + "blue_ice": "rgb(160, 160, 255)", + "conduit": "rgb(92, 219, 213)", + "bamboo_sapling": "rgb(143, 119, 72)", + "bamboo": "rgb(0, 124, 0)", + "bubble_column": "rgb(64, 64, 255)", + "scaffolding": "rgb(247, 233, 163)", + "loom": "rgb(143, 119, 72)", + "barrel": "rgb(143, 119, 72)", + "smoker": "rgb(112, 112, 112)", + "blast_furnace": "rgb(112, 112, 112)", + "cartography_table": "rgb(143, 119, 72)", + "fletching_table": "rgb(143, 119, 72)", + "grindstone": "rgb(167, 167, 167)", + "lectern": "rgb(143, 119, 72)", + "smithing_table": "rgb(143, 119, 72)", + "stonecutter": "rgb(112, 112, 112)", + "bell": "rgb(250, 238, 77)", + "lantern": "rgb(167, 167, 167)", + "soul_lantern": "rgb(167, 167, 167)", + "campfire": "rgb(129, 86, 49)", + "soul_campfire": "rgb(129, 86, 49)", + "sweet_berry_bush": "rgb(0, 124, 0)", + "warped_hyphae": "rgb(86, 44, 62)", + "stripped_warped_hyphae": "rgb(86, 44, 62)", + "warped_nylium": "rgb(22, 126, 134)", + "warped_fungus": "rgb(76, 127, 153)", + "warped_wart_block": "rgb(20, 180, 133)", + "warped_roots": "rgb(76, 127, 153)", + "nether_sprouts": "rgb(76, 127, 153)", + "crimson_hyphae": "rgb(92, 25, 29)", + "stripped_crimson_hyphae": "rgb(92, 25, 29)", + "crimson_nylium": "rgb(189, 48, 49)", + "crimson_fungus": "rgb(112, 2, 0)", + "shroomlight": "rgb(153, 51, 51)", + "weeping_vines": "rgb(112, 2, 0)", + "weeping_vines_plant": "rgb(112, 2, 0)", + "twisting_vines": "rgb(76, 127, 153)", + "twisting_vines_plant": "rgb(76, 127, 153)", + "crimson_roots": "rgb(112, 2, 0)", + "crimson_planks": "rgb(148, 63, 97)", + "warped_planks": "rgb(58, 142, 140)", + "structure_block": "rgb(153, 153, 153)", + "jigsaw": "rgb(153, 153, 153)", + "composter": "rgb(143, 119, 72)", + "target": "rgb(255, 252, 245)", + "bee_nest": "rgb(229, 229, 51)", + "beehive": "rgb(143, 119, 72)", + "honey_block": "rgb(216, 127, 51)", + "honeycomb_block": "rgb(216, 127, 51)", + "netherite_block": "rgb(25, 25, 25)", + "ancient_debris": "rgb(25, 25, 25)", + "crying_obsidian": "rgb(25, 25, 25)", + "respawn_anchor": "rgb(25, 25, 25)", + "lodestone": "rgb(167, 167, 167)", + "blackstone": "rgb(25, 25, 25)", + "polished_blackstone_pressure_plate": "rgb(25, 25, 25)", + "chiseled_nether_bricks": "rgb(112, 2, 0)", + "cracked_nether_bricks": "rgb(112, 2, 0)", + "amethyst_block": "rgb(127, 63, 178)", + "budding_amethyst": "rgb(127, 63, 178)", + "amethyst_cluster": "rgb(127, 63, 178)", + "tuff": "rgb(57, 41, 35)", + "calcite": "rgb(209, 177, 161)", + "tinted_glass": "rgb(76, 76, 76)", + "powder_snow": "rgb(255, 255, 255)", + "sculk_sensor": "rgb(76, 127, 153)", + "sculk": "rgb(25, 25, 25)", + "sculk_vein": "rgb(25, 25, 25)", + "sculk_catalyst": "rgb(25, 25, 25)", + "sculk_shrieker": "rgb(25, 25, 25)", + "oxidized_copper": "rgb(22, 126, 134)", + "weathered_copper": "rgb(58, 142, 140)", + "exposed_copper": "rgb(135, 107, 98)", + "copper_block": "rgb(216, 127, 51)", + "deepslate_copper_ore": "rgb(100, 100, 100)", + "lightning_rod": "rgb(216, 127, 51)", + "pointed_dripstone": "rgb(76, 50, 35)", + "dripstone_block": "rgb(76, 50, 35)", + "cave_vines": "rgb(0, 124, 0)", + "cave_vines_plant": "rgb(0, 124, 0)", + "spore_blossom": "rgb(0, 124, 0)", + "azalea": "rgb(0, 124, 0)", + "flowering_azalea": "rgb(0, 124, 0)", + "moss_carpet": "rgb(102, 127, 51)", + "pink_petals": "rgb(0, 124, 0)", + "moss_block": "rgb(102, 127, 51)", + "big_dripleaf": "rgb(0, 124, 0)", + "big_dripleaf_stem": "rgb(0, 124, 0)", + "small_dripleaf": "rgb(0, 124, 0)", + "hanging_roots": "rgb(151, 109, 77)", + "rooted_dirt": "rgb(151, 109, 77)", + "mud": "rgb(87, 92, 92)", + "deepslate": "rgb(100, 100, 100)", + "infested_deepslate": "rgb(100, 100, 100)", + "raw_iron_block": "rgb(216, 175, 147)", + "raw_copper_block": "rgb(216, 127, 51)", + "raw_gold_block": "rgb(250, 238, 77)", + "ochre_froglight": "rgb(247, 233, 163)", + "verdant_froglight": "rgb(127, 167, 150)", + "pearlescent_froglight": "rgb(242, 127, 165)", + "frogspawn": "rgb(64, 64, 255)", + "reinforced_deepslate": "rgb(100, 100, 100)", + "decorated_pot": "rgb(142, 60, 46)" } } diff --git a/prismarine-viewer/viewer/lib/simpleUtils.ts b/prismarine-viewer/viewer/lib/simpleUtils.ts index b46f9612..f4899993 100644 --- a/prismarine-viewer/viewer/lib/simpleUtils.ts +++ b/prismarine-viewer/viewer/lib/simpleUtils.ts @@ -16,3 +16,10 @@ export function chunkPos (pos: { x: number, z: number }) { const z = Math.floor(pos.z / 16) return [x, z] } + +export function sectionPos (pos: { x: number, y: number, z: number }) { + const x = Math.floor(pos.x / 16) + const y = Math.floor(pos.z / 16) + const z = Math.floor(pos.z / 16) + return [x, y, z] +} diff --git a/prismarine-viewer/viewer/lib/worldDataEmitter.ts b/prismarine-viewer/viewer/lib/worldDataEmitter.ts index 67481625..f79a8a55 100644 --- a/prismarine-viewer/viewer/lib/worldDataEmitter.ts +++ b/prismarine-viewer/viewer/lib/worldDataEmitter.ts @@ -48,6 +48,7 @@ export class WorldDataEmitter extends EventEmitter { emitEntity(e) }, entityUpdate: (e: any) => { + emitEntity(e) }, entityMoved: (e: any) => { emitEntity(e) diff --git a/prismarine-viewer/viewer/lib/worldrenderer.ts b/prismarine-viewer/viewer/lib/worldrenderer.ts index 3b5fb349..8f3221a3 100644 --- a/prismarine-viewer/viewer/lib/worldrenderer.ts +++ b/prismarine-viewer/viewer/lib/worldrenderer.ts @@ -9,7 +9,7 @@ import { dispose3 } from './dispose' import { toMajor } from './version.js' import PrismarineChatLoader from 'prismarine-chat' import { renderSign } from '../sign-renderer/' -import { chunkPos } from './simpleUtils' +import { chunkPos, sectionPos } from './simpleUtils' function mod (x, n) { return ((x % n) + n) % n @@ -260,7 +260,7 @@ export class WorldRenderer { const loadBlockStates = async () => { return new Promise(resolve => { if (this.customBlockStatesData) return resolve(this.customBlockStatesData) - return loadJSON(`blocksStates/${this.texturesVersion}.json`, (data) => { + return loadJSON(`/blocksStates/${this.texturesVersion}.json`, (data) => { this.downloadedBlockStatesData = data // todo this.renderUpdateEmitter.emit('blockStatesDownloaded') @@ -275,12 +275,13 @@ export class WorldRenderer { }) } - getLoadedChunksRelative (pos: Vec3) { - const [currentX, currentZ] = chunkPos(pos) + getLoadedChunksRelative (pos: Vec3, includeY = false) { + const [currentX, currentY, currentZ] = sectionPos(pos) return Object.fromEntries(Object.entries(this.sectionObjects).map(([key, o]) => { const [xRaw, yRaw, zRaw] = key.split(',').map(Number) - const [x, z] = chunkPos({ x: xRaw, z: zRaw }) - return [`${x - currentX},${z - currentZ}`, o] + const [x, y, z] = sectionPos({ x: xRaw, y: yRaw, z: zRaw }) + const setKey = includeY ? `${x - currentX},${y - currentY},${z - currentZ}` : `${x - currentX},${z - currentZ}` + return [setKey, o] })) } diff --git a/src/GlobalSearchInput.tsx b/src/GlobalSearchInput.tsx new file mode 100644 index 00000000..c29c64a4 --- /dev/null +++ b/src/GlobalSearchInput.tsx @@ -0,0 +1,34 @@ +import { useSnapshot } from 'valtio' +import { miscUiState } from './globalState' +import Input from './react/Input' + +function InnerSearch () { + const { currentTouch } = useSnapshot(miscUiState) + + return
+ { + customEvents.emit('search', value) + }} + /> +
+} + +// todo remove component as its not possible to reuse this component atm +export default () => { + const { displaySearchInput } = useSnapshot(miscUiState) + + return displaySearchInput ? : null +} diff --git a/src/basicSounds.ts b/src/basicSounds.ts index a16193fe..53c86652 100644 --- a/src/basicSounds.ts +++ b/src/basicSounds.ts @@ -1,5 +1,6 @@ import { options } from './optionsStorage' import { isCypress } from './standaloneUtils' +import { reportWarningOnce } from './utils' let audioContext: AudioContext const sounds: Record = {} @@ -39,7 +40,12 @@ export async function playSound (url, soundVolume = 1) { if (!volume) return - audioContext ??= new window.AudioContext() + try { + audioContext ??= new window.AudioContext() + } catch (err) { + reportWarningOnce('audioContext', 'Failed to create audio context. Some sounds will not play') + return + } for (const [soundName, sound] of Object.entries(sounds)) { if (convertedSounds.includes(soundName)) continue diff --git a/src/botUtils.ts b/src/botUtils.ts index cc624c5b..5dacbf4f 100644 --- a/src/botUtils.ts +++ b/src/botUtils.ts @@ -105,3 +105,15 @@ export const formatMessage = (message: MessageInput) => { return msglist } + +const blockToItemRemaps = { + water: 'water_bucket', + lava: 'lava_bucket', + redstone_wire: 'redstone', + tripwire: 'tripwire_hook' +} + +export const getItemFromBlock = (block: import('prismarine-block').Block) => { + const item = loadedData.items[blockToItemRemaps[block.name] ?? block.name] + return item +} diff --git a/src/browserfs.ts b/src/browserfs.ts index 404800ea..13c266ac 100644 --- a/src/browserfs.ts +++ b/src/browserfs.ts @@ -7,7 +7,7 @@ import * as browserfs from 'browserfs' import { options, resetOptions } from './optionsStorage' import { fsState, loadSave } from './loadSave' -import { installTexturePackFromHandle, updateTexturePackInstalledState } from './texturePack' +import { installTexturePack, installTexturePackFromHandle, updateTexturePackInstalledState } from './texturePack' import { miscUiState } from './globalState' import { setLoadingScreenStatus } from './utils' @@ -422,3 +422,42 @@ export const resetLocalStorageWithoutWorld = () => { } window.resetLocalStorageWorld = resetLocalStorageWorld +export const openFilePicker = (specificCase?: 'resourcepack') => { + // create and show input picker + let picker: HTMLInputElement = document.body.querySelector('input#file-zip-picker')! + if (!picker) { + picker = document.createElement('input') + picker.type = 'file' + picker.accept = '.zip' + + picker.addEventListener('change', () => { + const file = picker.files?.[0] + picker.value = '' + if (!file) return + if (!file.name.endsWith('.zip')) { + const doContinue = confirm(`Are you sure ${file.name.slice(-20)} is .zip file? Only .zip files are supported. Continue?`) + if (!doContinue) return + } + if (specificCase === 'resourcepack') { + void installTexturePack(file) + } else { + void openWorldZip(file) + } + }) + picker.hidden = true + document.body.appendChild(picker) + } + + picker.click() +} + +export const resetStateAfterDisconnect = () => { + miscUiState.gameLoaded = false + miscUiState.loadedDataVersion = null + miscUiState.singleplayer = false + miscUiState.flyingSquid = false + miscUiState.wanOpened = false + miscUiState.currentDisplayQr = null + + fsState.saveLoaded = false +} diff --git a/src/builtinCommands.ts b/src/builtinCommands.ts index 71208baf..e68daa03 100644 --- a/src/builtinCommands.ts +++ b/src/builtinCommands.ts @@ -106,7 +106,7 @@ const commands: Array<{ { command: ['/save'], async invoke () { - await saveServer() + await saveServer(false) } } ] diff --git a/src/controls.ts b/src/controls.ts index 4ddc349d..068b16b0 100644 --- a/src/controls.ts +++ b/src/controls.ts @@ -14,6 +14,7 @@ import { chatInputValueGlobal } from './react/ChatContainer' import { fsState } from './loadSave' import { showOptionsModal } from './react/SelectOption' import widgets from './react/widgets' +import { getItemFromBlock } from './botUtils' // doesnt seem to work for now const customKeymaps = proxy(JSON.parse(localStorage.keymap || '{}')) @@ -67,6 +68,7 @@ export const contro = new ControMax({ }, gamepadPollingInterval: 10 }) +window.controMax = contro export type Command = CommandEventArgument['command'] const setSprinting = (state: boolean) => { @@ -413,12 +415,12 @@ let allowFlying = false export const onBotCreate = () => { bot._client.on('abilities', ({ flags }) => { - allowFlying = !!(flags & 4) if (flags & 2) { // flying toggleFly(true, false) } else { toggleFly(false, false) } + allowFlying = !!(flags & 4) }) } @@ -443,7 +445,7 @@ const toggleFly = (newState = !isFlying(), sendAbilities?: boolean) => { const selectItem = async () => { const block = bot.blockAtCursor(5) if (!block) return - const itemId = loadedData.itemsByName[block.name]?.id + const itemId = getItemFromBlock(block)?.id if (!itemId) return const Item = require('prismarine-item')(bot.version) const item = new Item(itemId, 1, 0) diff --git a/src/dayCycle.ts b/src/dayCycle.ts index 86e69add..b4bf58d8 100644 --- a/src/dayCycle.ts +++ b/src/dayCycle.ts @@ -6,9 +6,9 @@ export default () => { assertDefined(viewer) // 0 morning const dayTotal = 24_000 - const evening = 12_542 - const night = 17_843 - const morningStart = 22_300 + const evening = 11_500 + const night = 13_500 + const morningStart = 23_000 const morningEnd = 23_961 const timeProgress = options.dayCycleAndLighting ? bot.time.timeOfDay : 0 diff --git a/src/devtools.ts b/src/devtools.ts index 4df8f69e..e49fdcfc 100644 --- a/src/devtools.ts +++ b/src/devtools.ts @@ -13,3 +13,6 @@ window.cursorBlockRel = (x = 0, y = 0, z = 0) => { window.cursorEntity = () => { return getEntityCursor() } + +// wanderer +window.inspectPlayer = () => require('fs').promises.readFile('/world/playerdata/9e487d23-2ffc-365a-b1f8-f38203f59233.dat').then(window.nbt.parse).then(console.log) diff --git a/src/entities.ts b/src/entities.ts index 4e8fb0d2..0e000c12 100644 --- a/src/entities.ts +++ b/src/entities.ts @@ -1,7 +1,10 @@ import { Entity } from 'prismarine-entity' +import tracker from '@nxg-org/mineflayer-tracker' import { options, watchValue } from './optionsStorage' customEvents.on('gameLoaded', () => { + bot.loadPlugin(tracker) + // todo cleanup (move to viewer, also shouldnt be used at all) const playerPerAnimation = {} as Record const entityData = (e: Entity) => { @@ -10,6 +13,7 @@ customEvents.on('gameLoaded', () => { window.debugEntityMetadata[e.username] = e // todo entity spawn timing issue, check perf if (viewer.entities.entities[e.id]?.playerObject) { + bot.tracker.trackEntity(e) const { playerObject } = viewer.entities.entities[e.id] playerObject.backEquipment = e.equipment.some((item) => item?.name === 'elytra') ? 'elytra' : 'cape' if (playerObject.cape.map === null) { @@ -17,18 +21,27 @@ customEvents.on('gameLoaded', () => { } // todo (easy, important) elytra flying animation // todo cleanup states - const WALKING_SPEED = 0.1 - const SPRINTING_SPEED = 0.15 - const isWalking = Math.abs(e.velocity.x) > WALKING_SPEED || Math.abs(e.velocity.z) > WALKING_SPEED - const isSprinting = Math.abs(e.velocity.x) > SPRINTING_SPEED || Math.abs(e.velocity.z) > SPRINTING_SPEED - const newAnimation = isWalking ? (isSprinting ? 'running' : 'walking') : 'idle' - if (newAnimation !== playerPerAnimation[e.username]) { - viewer.entities.playAnimation(e.id, newAnimation) - playerPerAnimation[e.username] = newAnimation - } } } + bot.on('physicsTick', () => { + for (const [id, { tracking, info }] of Object.entries(bot.tracker.trackingData)) { + if (!tracking) continue + const e = bot.entities[id]! + const speed = info.avgSpeed + const WALKING_SPEED = 0.03 + const SPRINTING_SPEED = 0.18 + const isWalking = Math.abs(speed.x) > WALKING_SPEED || Math.abs(speed.z) > WALKING_SPEED + const isSprinting = Math.abs(speed.x) > SPRINTING_SPEED || Math.abs(speed.z) > SPRINTING_SPEED + const newAnimation = isWalking ? (isSprinting ? 'running' : 'walking') : 'idle' + const username = e.username! + if (newAnimation !== playerPerAnimation[username]) { + viewer.entities.playAnimation(e.id, newAnimation) + playerPerAnimation[username] = newAnimation + } + } + }) + bot.on('entitySwingArm', (e) => { if (viewer.entities.entities[e.id]?.playerObject) { viewer.entities.playAnimation(e.id, 'oneSwing') @@ -54,6 +67,7 @@ customEvents.on('gameLoaded', () => { viewer.entities.addListener('remove', (e) => { loadedSkinEntityIds.delete(e.id) playerPerAnimation[e.username] = '' + bot.tracker.stopTrackingEntity(e, true) }) bot.on('entityMoved', (e) => { diff --git a/src/flyingSquidUtils.ts b/src/flyingSquidUtils.ts index 1aef8d07..2590468d 100644 --- a/src/flyingSquidUtils.ts +++ b/src/flyingSquidUtils.ts @@ -17,15 +17,25 @@ export function nameToMcOfflineUUID (name) { return (new UUID(javaUUID('OfflinePlayer:' + name))).toString() } -export async function savePlayers () { +export async function savePlayers (autoSave: boolean) { + if (autoSave && new URL(location.href).searchParams.get('noSave') === 'true') return //@ts-expect-error TODO await localServer!.savePlayersSingleplayer() } // todo flying squid should expose save function instead -export const saveServer = async () => { +export const saveServer = async (autoSave = true) => { if (!localServer || fsState.isReadonly) return // todo const worlds = [(localServer as any).overworld] as Array - await Promise.all([savePlayers(), ...worlds.map(async world => world.saveNow())]) + await Promise.all([savePlayers(autoSave), ...worlds.map(async world => world.saveNow())]) +} +export const disconnect = async () => { + if (localServer) { + await saveServer() + //@ts-expect-error todo expose! + void localServer.quit() // todo investigate we should await + } + window.history.replaceState({}, '', `${window.location.pathname}`) // remove qs + bot.end('You left the server') } diff --git a/src/gameUnload.ts b/src/gameUnload.ts new file mode 100644 index 00000000..d5622411 --- /dev/null +++ b/src/gameUnload.ts @@ -0,0 +1,17 @@ +import { subscribe } from 'valtio' +import { miscUiState } from './globalState' + +let toCleanup = [] as Array<() => void> + +export const watchUnloadForCleanup = (func: () => void) => { + toCleanup.push(func) +} + +subscribe(miscUiState, () => { + if (!miscUiState.gameLoaded) { + for (const func of toCleanup) { + func() + } + toCleanup = [] + } +}) diff --git a/src/generatedClientPackets.ts b/src/generatedClientPackets.ts new file mode 100644 index 00000000..2715cd73 --- /dev/null +++ b/src/generatedClientPackets.ts @@ -0,0 +1,543 @@ +export interface ClientWriteMap { + keep_alive: /** 1.7 */ { + keepAliveId: number; + } | /** 1.12.2 */ { + keepAliveId: bigint; + }; + /** Removed in 1.19 */ + chat: /** 1.7 */ { + message: string; + }; + use_entity: /** 1.7 */ { + target: number; + mouse: number; + x: any; + y: any; + z: any; + } | /** 1.9 */ { + target: number; + mouse: number; + x: any; + y: any; + z: any; + hand: any; + } | /** 1.16 */ { + target: number; + mouse: number; + x: any; + y: any; + z: any; + hand: any; + sneaking: boolean; + }; + flying: /** 1.7 */ { + onGround: boolean; + }; + position: /** 1.7 */ { + x: number; + stance: number; + y: number; + z: number; + onGround: boolean; + } | /** 1.8 */ { + x: number; + y: number; + z: number; + onGround: boolean; + }; + look: /** 1.7 */ { + yaw: number; + pitch: number; + onGround: boolean; + }; + position_look: /** 1.7 */ { + x: number; + stance: number; + y: number; + z: number; + yaw: number; + pitch: number; + onGround: boolean; + } | /** 1.8 */ { + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + onGround: boolean; + }; + block_dig: /** 1.7 */ { + status: number; + location: any; + face: number; + } | /** 1.8 */ { + status: number; + location: { x: number, y: number, z: number }; + face: number; + } | /** 1.19 */ { + status: number; + location: { x: number, y: number, z: number }; + face: number; + sequence: number; + }; + block_place: /** 1.7 */ { + location: any; + direction: number; + heldItem: any; + cursorX: number; + cursorY: number; + cursorZ: number; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + direction: number; + heldItem: any; + cursorX: number; + cursorY: number; + cursorZ: number; + } | /** 1.9 */ { + location: { x: number, y: number, z: number }; + direction: number; + hand: number; + cursorX: number; + cursorY: number; + cursorZ: number; + } | /** 1.14 */ { + hand: number; + location: { x: number, y: number, z: number }; + direction: number; + cursorX: number; + cursorY: number; + cursorZ: number; + insideBlock: boolean; + } | /** 1.19 */ { + hand: number; + location: { x: number, y: number, z: number }; + direction: number; + cursorX: number; + cursorY: number; + cursorZ: number; + insideBlock: boolean; + sequence: number; + }; + held_item_slot: /** 1.7 */ { + slotId: number; + }; + arm_animation: /** 1.7 */ { + entityId: number; + animation: number; + } | /** 1.8 */ { + + } | /** 1.9 */ { + hand: number; + }; + entity_action: /** 1.7 */ { + entityId: number; + actionId: number; + jumpBoost: number; + }; + steer_vehicle: /** 1.7 */ { + sideways: number; + forward: number; + jump: boolean; + unmount: boolean; + } | /** 1.8 */ { + sideways: number; + forward: number; + jump: number; + }; + close_window: /** 1.7 */ { + windowId: number; + }; + window_click: /** 1.7 */ { + windowId: number; + slot: number; + mouseButton: number; + action: number; + mode: number; + item: any; + } | /** 1.17 */ { + windowId: number; + slot: number; + mouseButton: number; + mode: number; + changedSlots: any; + cursorItem: any; + } | /** 1.17.1 */ { + windowId: number; + stateId: number; + slot: number; + mouseButton: number; + mode: number; + changedSlots: any; + cursorItem: any; + }; + /** Removed in 1.17 */ + transaction: /** 1.7 */ { + windowId: number; + action: number; + accepted: boolean; + }; + set_creative_slot: /** 1.7 */ { + slot: number; + item: any; + }; + enchant_item: /** 1.7 */ { + windowId: number; + enchantment: number; + }; + update_sign: /** 1.7 */ { + location: any; + text1: string; + text2: string; + text3: string; + text4: string; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + text1: string; + text2: string; + text3: string; + text4: string; + } | /** 1.20 */ { + location: { x: number, y: number, z: number }; + isFrontText: boolean; + text1: string; + text2: string; + text3: string; + text4: string; + }; + abilities: /** 1.7 */ { + flags: number; + flyingSpeed: number; + walkingSpeed: number; + } | /** 1.16 */ { + flags: number; + }; + tab_complete: /** 1.7 */ { + text: string; + } | /** 1.8 */ { + text: string; + block: any; + } | /** 1.9 */ { + text: string; + assumeCommand: boolean; + lookedAtBlock: any; + } | /** 1.13 */ { + transactionId: number; + text: string; + }; + settings: /** 1.7 */ { + locale: string; + viewDistance: number; + chatFlags: number; + chatColors: boolean; + difficulty: number; + showCape: boolean; + } | /** 1.8 */ { + locale: string; + viewDistance: number; + chatFlags: number; + chatColors: boolean; + skinParts: number; + } | /** 1.9 */ { + locale: string; + viewDistance: number; + chatFlags: number; + chatColors: boolean; + skinParts: number; + mainHand: number; + } | /** 1.17 */ { + locale: string; + viewDistance: number; + chatFlags: number; + chatColors: boolean; + skinParts: number; + mainHand: number; + disableTextFiltering: boolean; + } | /** 1.18 */ { + locale: string; + viewDistance: number; + chatFlags: number; + chatColors: boolean; + skinParts: number; + mainHand: number; + enableTextFiltering: boolean; + enableServerListing: boolean; + }; + client_command: /** 1.7 */ { + payload: number; + } | /** 1.9 */ { + actionId: number; + }; + custom_payload: /** 1.7 */ { + channel: string; + data: any; + }; + packet: /** 1.7 */ { + name: any; + params: any; + }; + spectate: /** 1.8 */ { + target: any; + }; + resource_pack_receive: /** 1.8 */ { + hash: string; + result: number; + } | /** 1.10 */ { + result: number; + } | /** 1.20.3 */ { + uuid: any; + result: number; + }; + teleport_confirm: /** 1.9 */ { + teleportId: number; + }; + vehicle_move: /** 1.9 */ { + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + }; + steer_boat: /** 1.9 */ { + leftPaddle: boolean; + rightPaddle: boolean; + }; + use_item: /** 1.9 */ { + hand: number; + } | /** 1.19 */ { + hand: number; + sequence: number; + }; + /** Removed in 1.12.1 */ + prepare_crafting_grid: /** 1.12 */ { + windowId: number; + actionNumber: number; + returnEntry: any; + prepareEntry: any; + }; + /** Removed in 1.16.2 */ + crafting_book_data: /** 1.12 */ { + type: number; + undefined: any; + }; + advancement_tab: /** 1.12 */ { + action: number; + tabId: any; + }; + craft_recipe_request: /** 1.12.1 */ { + windowId: number; + recipe: number; + makeAll: boolean; + } | /** 1.13 */ { + windowId: number; + recipe: string; + makeAll: boolean; + }; + query_block_nbt: /** 1.13 */ { + transactionId: number; + location: { x: number, y: number, z: number }; + }; + edit_book: /** 1.13 */ { + new_book: any; + signing: boolean; + } | /** 1.13.1 */ { + new_book: any; + signing: boolean; + hand: number; + } | /** 1.17.1 */ { + hand: number; + pages: any; + title: any; + }; + query_entity_nbt: /** 1.13 */ { + transactionId: number; + entityId: number; + }; + pick_item: /** 1.13 */ { + slot: number; + }; + name_item: /** 1.13 */ { + name: string; + }; + select_trade: /** 1.13 */ { + slot: number; + }; + set_beacon_effect: /** 1.13 */ { + primary_effect: number; + secondary_effect: number; + } | /** 1.19 */ { + primary_effect: any; + secondary_effect: any; + }; + update_command_block: /** 1.13 */ { + location: { x: number, y: number, z: number }; + command: string; + mode: number; + flags: number; + }; + update_command_block_minecart: /** 1.13 */ { + entityId: number; + command: string; + track_output: boolean; + }; + update_structure_block: /** 1.13 */ { + location: { x: number, y: number, z: number }; + action: number; + mode: number; + name: string; + offset_x: number; + offset_y: number; + offset_z: number; + size_x: number; + size_y: number; + size_z: number; + mirror: number; + rotation: number; + metadata: string; + integrity: number; + seed: any; + flags: number; + } | /** 1.19 */ { + location: { x: number, y: number, z: number }; + action: number; + mode: number; + name: string; + offset_x: number; + offset_y: number; + offset_z: number; + size_x: number; + size_y: number; + size_z: number; + mirror: number; + rotation: number; + metadata: string; + integrity: number; + seed: number; + flags: number; + }; + set_difficulty: /** 1.14 */ { + newDifficulty: number; + }; + lock_difficulty: /** 1.14 */ { + locked: boolean; + }; + update_jigsaw_block: /** 1.14 */ { + location: { x: number, y: number, z: number }; + attachmentType: string; + targetPool: string; + finalState: string; + } | /** 1.16 */ { + location: { x: number, y: number, z: number }; + name: string; + target: string; + pool: string; + finalState: string; + jointType: string; + } | /** 1.20.3 */ { + location: { x: number, y: number, z: number }; + name: string; + target: string; + pool: string; + finalState: string; + jointType: string; + selection_priority: number; + placement_priority: number; + }; + generate_structure: /** 1.16 */ { + location: { x: number, y: number, z: number }; + levels: number; + keepJigsaws: boolean; + }; + displayed_recipe: /** 1.16.2 */ { + recipeId: string; + }; + recipe_book: /** 1.16.2 */ { + bookId: number; + bookOpen: boolean; + filterActive: boolean; + }; + pong: /** 1.17 */ { + id: number; + }; + chat_command: /** 1.19 */ { + command: string; + timestamp: bigint; + salt: bigint; + argumentSignatures: any; + signedPreview: boolean; + } | /** 1.19.2 */ { + command: string; + timestamp: bigint; + salt: bigint; + argumentSignatures: any; + signedPreview: boolean; + previousMessages: any; + lastRejectedMessage: any; + } | /** 1.19.3 */ { + command: string; + timestamp: bigint; + salt: bigint; + argumentSignatures: any; + messageCount: number; + acknowledged: any; + }; + chat_message: /** 1.19 */ { + message: string; + timestamp: bigint; + salt: bigint; + signature: any; + signedPreview: boolean; + } | /** 1.19.2 */ { + message: string; + timestamp: bigint; + salt: bigint; + signature: any; + signedPreview: boolean; + previousMessages: any; + lastRejectedMessage: any; + } | /** 1.19.3 */ { + message: string; + timestamp: bigint; + salt: bigint; + signature: any; + offset: number; + acknowledged: any; + }; + /** Removed in 1.19.3 */ + chat_preview: /** 1.19 */ { + query: number; + message: string; + }; + message_acknowledgement: /** 1.19.2 */ { + previousMessages: any; + lastRejectedMessage: any; + } | /** 1.19.3 */ { + count: number; + }; + chat_session_update: /** 1.19.3 */ { + sessionUUID: any; + expireTime: bigint; + publicKey: any; + signature: any; + }; + chunk_batch_received: /** 1.20.2 */ { + chunksPerTick: number; + }; + /** Removed in 1.20.3 */ + configuation_acknowledged: /** 1.20.2 */ { + + }; + ping_request: /** 1.20.2 */ { + id: bigint; + }; + configuration_acknowledged: /** 1.20.3 */ { + + }; + set_slot_state: /** 1.20.3 */ { + slot_id: number; + window_id: number; + state: boolean; + }; +} + +export declare const clientWrite: (name: T, data: ClientWriteMap[T]) => Buffer diff --git a/src/generatedServerPackets.ts b/src/generatedServerPackets.ts new file mode 100644 index 00000000..ffc232c5 --- /dev/null +++ b/src/generatedServerPackets.ts @@ -0,0 +1,1495 @@ +// from server to client + +export interface ClientOnMap { + keep_alive: /** 1.7 */ { + keepAliveId: number; + } | /** 1.12.2 */ { + keepAliveId: bigint; + }; + login: /** 1.7 */ { + entityId: number; + gameMode: number; + dimension: number; + difficulty: number; + maxPlayers: number; + levelType: string; + } | /** 1.8 */ { + entityId: number; + gameMode: number; + dimension: number; + difficulty: number; + maxPlayers: number; + levelType: string; + reducedDebugInfo: boolean; + } | /** 1.14 */ { + entityId: number; + gameMode: number; + dimension: number; + maxPlayers: number; + levelType: string; + viewDistance: number; + reducedDebugInfo: boolean; + } | /** 1.15 */ { + entityId: number; + gameMode: number; + dimension: number; + hashedSeed: bigint; + maxPlayers: number; + levelType: string; + viewDistance: number; + reducedDebugInfo: boolean; + enableRespawnScreen: boolean; + } | /** 1.16 */ { + entityId: number; + gameMode: number; + previousGameMode: number; + worldNames: any; + dimensionCodec: any; + dimension: string; + worldName: string; + hashedSeed: bigint; + maxPlayers: number; + viewDistance: number; + reducedDebugInfo: boolean; + enableRespawnScreen: boolean; + isDebug: boolean; + isFlat: boolean; + } | /** 1.16.2 */ { + entityId: number; + isHardcore: boolean; + gameMode: number; + previousGameMode: number; + worldNames: any; + dimensionCodec: any; + dimension: any; + worldName: string; + hashedSeed: bigint; + maxPlayers: number; + viewDistance: number; + reducedDebugInfo: boolean; + enableRespawnScreen: boolean; + isDebug: boolean; + isFlat: boolean; + } | /** 1.18 */ { + entityId: number; + isHardcore: boolean; + gameMode: number; + previousGameMode: number; + worldNames: any; + dimensionCodec: any; + dimension: any; + worldName: string; + hashedSeed: bigint; + maxPlayers: number; + viewDistance: number; + simulationDistance: number; + reducedDebugInfo: boolean; + enableRespawnScreen: boolean; + isDebug: boolean; + isFlat: boolean; + } | /** 1.19 */ { + entityId: number; + isHardcore: boolean; + gameMode: number; + previousGameMode: number; + worldNames: any; + dimensionCodec: any; + worldType: string; + worldName: string; + hashedSeed: bigint; + maxPlayers: number; + viewDistance: number; + simulationDistance: number; + reducedDebugInfo: boolean; + enableRespawnScreen: boolean; + isDebug: boolean; + isFlat: boolean; + death: any; + } | /** 1.20 */ { + entityId: number; + isHardcore: boolean; + gameMode: number; + previousGameMode: number; + worldNames: any; + dimensionCodec: any; + worldType: string; + worldName: string; + hashedSeed: bigint; + maxPlayers: number; + viewDistance: number; + simulationDistance: number; + reducedDebugInfo: boolean; + enableRespawnScreen: boolean; + isDebug: boolean; + isFlat: boolean; + death: any; + portalCooldown: number; + }; + /** Removed in 1.19 */ + chat: /** 1.7 */ { + message: string; + } | /** 1.8 */ { + message: string; + position: number; + } | /** 1.16 */ { + message: string; + position: number; + sender: any; + }; + update_time: /** 1.7 */ { + age: bigint; + time: bigint; + }; + entity_equipment: /** 1.7 */ { + entityId: number; + slot: number; + item: any; + } | /** 1.16 */ { + entityId: number; + equipments: any; + }; + spawn_position: /** 1.7 */ { + location: any; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + } | /** 1.17 */ { + location: { x: number, y: number, z: number }; + angle: number; + }; + update_health: /** 1.7 */ { + health: number; + food: number; + foodSaturation: number; + }; + respawn: /** 1.7 */ { + dimension: number; + difficulty: number; + gamemode: number; + levelType: string; + } | /** 1.14 */ { + dimension: number; + gamemode: number; + levelType: string; + } | /** 1.15 */ { + dimension: number; + hashedSeed: bigint; + gamemode: number; + levelType: string; + } | /** 1.16 */ { + dimension: string; + worldName: string; + hashedSeed: bigint; + gamemode: number; + previousGamemode: number; + isDebug: boolean; + isFlat: boolean; + copyMetadata: boolean; + } | /** 1.16.2 */ { + dimension: any; + worldName: string; + hashedSeed: bigint; + gamemode: number; + previousGamemode: number; + isDebug: boolean; + isFlat: boolean; + copyMetadata: boolean; + } | /** 1.19 */ { + dimension: string; + worldName: string; + hashedSeed: bigint; + gamemode: number; + previousGamemode: number; + isDebug: boolean; + isFlat: boolean; + copyMetadata: boolean; + death: any; + } | /** 1.20 */ { + dimension: string; + worldName: string; + hashedSeed: bigint; + gamemode: number; + previousGamemode: number; + isDebug: boolean; + isFlat: boolean; + copyMetadata: boolean; + death: any; + portalCooldown: number; + }; + position: /** 1.7 */ { + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + onGround: boolean; + } | /** 1.8 */ { + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + flags: number; + } | /** 1.9 */ { + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + flags: number; + teleportId: number; + } | /** 1.17 */ { + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + flags: number; + teleportId: number; + dismountVehicle: boolean; + } /** 1.19.4 */ ; + held_item_slot: /** 1.7 */ { + slot: number; + }; + /** Removed in 1.14 */ + bed: /** 1.7 */ { + entityId: number; + location: any; + } | /** 1.8 */ { + entityId: number; + location: { x: number, y: number, z: number }; + }; + animation: /** 1.7 */ { + entityId: number; + animation: number; + }; + named_entity_spawn: /** 1.7 */ { + entityId: number; + playerUUID: string; + playerName: string; + data: any; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + currentItem: number; + metadata: any; + } | /** 1.8 */ { + entityId: number; + playerUUID: any; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + currentItem: number; + metadata: any; + } | /** 1.9 */ { + entityId: number; + playerUUID: any; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + metadata: any; + } | /** 1.15 */ { + entityId: number; + playerUUID: any; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + }; + collect: /** 1.7 */ { + collectedEntityId: number; + collectorEntityId: number; + } | /** 1.11 */ { + collectedEntityId: number; + collectorEntityId: number; + pickupItemCount: number; + }; + spawn_entity: /** 1.7 */ { + entityId: number; + type: number; + x: number; + y: number; + z: number; + pitch: number; + yaw: number; + objectData: any; + } | /** 1.9 */ { + entityId: number; + objectUUID: any; + type: number; + x: number; + y: number; + z: number; + pitch: number; + yaw: number; + objectData: number; + velocityX: number; + velocityY: number; + velocityZ: number; + } | /** 1.19 */ { + entityId: number; + objectUUID: any; + type: number; + x: number; + y: number; + z: number; + pitch: number; + yaw: number; + headPitch: number; + objectData: number; + velocityX: number; + velocityY: number; + velocityZ: number; + }; + /** Removed in 1.19 */ + spawn_entity_living: /** 1.7 */ { + entityId: number; + type: number; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + headPitch: number; + velocityX: number; + velocityY: number; + velocityZ: number; + metadata: any; + } | /** 1.9 */ { + entityId: number; + entityUUID: any; + type: number; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + headPitch: number; + velocityX: number; + velocityY: number; + velocityZ: number; + metadata: any; + } | /** 1.15 */ { + entityId: number; + entityUUID: any; + type: number; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + headPitch: number; + velocityX: number; + velocityY: number; + velocityZ: number; + }; + /** Removed in 1.19 */ + spawn_entity_painting: /** 1.7 */ { + entityId: number; + title: string; + location: any; + direction: number; + } | /** 1.8 */ { + entityId: number; + title: string; + location: { x: number, y: number, z: number }; + direction: number; + } | /** 1.9 */ { + entityId: number; + entityUUID: any; + title: string; + location: { x: number, y: number, z: number }; + direction: number; + } | /** 1.13 */ { + entityId: number; + entityUUID: any; + title: number; + location: { x: number, y: number, z: number }; + direction: number; + }; + spawn_entity_experience_orb: /** 1.7 */ { + entityId: number; + x: number; + y: number; + z: number; + count: number; + }; + entity_velocity: /** 1.7 */ { + entityId: number; + velocityX: number; + velocityY: number; + velocityZ: number; + }; + /** Removed in 1.17 */ + entity_destroy: /** 1.17.1 */ { + entityIds: any; + }; + /** Removed in 1.17 */ + entity: /** 1.7 */ { + entityId: number; + }; + rel_entity_move: /** 1.7 */ { + entityId: number; + dX: number; + dY: number; + dZ: number; + } | /** 1.8 */ { + entityId: number; + dX: number; + dY: number; + dZ: number; + onGround: boolean; + }; + entity_look: /** 1.7 */ { + entityId: number; + yaw: number; + pitch: number; + } | /** 1.8 */ { + entityId: number; + yaw: number; + pitch: number; + onGround: boolean; + }; + entity_move_look: /** 1.7 */ { + entityId: number; + dX: number; + dY: number; + dZ: number; + yaw: number; + pitch: number; + } | /** 1.8 */ { + entityId: number; + dX: number; + dY: number; + dZ: number; + yaw: number; + pitch: number; + onGround: boolean; + }; + entity_teleport: /** 1.7 */ { + entityId: number; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + } | /** 1.8 */ { + entityId: number; + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + onGround: boolean; + }; + entity_head_rotation: /** 1.7 */ { + entityId: number; + headYaw: number; + }; + entity_status: /** 1.7 */ { + entityId: number; + entityStatus: number; + }; + attach_entity: /** 1.7 */ { + entityId: number; + vehicleId: number; + leash: boolean; + } | /** 1.9 */ { + entityId: number; + vehicleId: number; + }; + entity_metadata: /** 1.7 */ { + entityId: number; + metadata: any; + }; + entity_effect: /** 1.7 */ { + entityId: number; + effectId: number; + amplifier: number; + duration: number; + } | /** 1.8 */ { + entityId: number; + effectId: number; + amplifier: number; + duration: number; + hideParticles: boolean; + } | /** 1.9 */ { + entityId: number; + effectId: number; + amplifier: number; + duration: number; + hideParticles: number; + } | /** 1.19 */ { + entityId: number; + effectId: number; + amplifier: number; + duration: number; + hideParticles: number; + factorCodec: any; + }; + remove_entity_effect: /** 1.7 */ { + entityId: number; + effectId: number; + }; + experience: /** 1.7 */ { + experienceBar: number; + level: number; + totalExperience: number; + } | /** 1.19.3 */ { + experienceBar: number; + totalExperience: number; + level: number; + }; + /** Removed in 1.9 */ + update_attributes: /** 1.7 */ { + entityId: number; + properties: any; + }; + map_chunk: /** 1.7 */ { + x: number; + z: number; + groundUp: boolean; + bitMap: number; + addBitMap: number; + compressedChunkData: any; + } | /** 1.8 */ { + x: number; + z: number; + groundUp: boolean; + bitMap: number; + chunkData: any; + } | /** 1.9.4 */ { + x: number; + z: number; + groundUp: boolean; + bitMap: number; + chunkData: any; + blockEntities: any; + } | /** 1.14 */ { + x: number; + z: number; + groundUp: boolean; + bitMap: number; + heightmaps: any; + chunkData: any; + blockEntities: any; + } | /** 1.15 */ { + x: number; + z: number; + groundUp: boolean; + bitMap: number; + heightmaps: any; + biomes: any; + chunkData: any; + blockEntities: any; + } | /** 1.16 */ { + x: number; + z: number; + groundUp: boolean; + ignoreOldData: boolean; + bitMap: number; + heightmaps: any; + biomes: any; + chunkData: any; + blockEntities: any; + } /** 1.16.2 */ | /** 1.17 */ { + x: number; + z: number; + bitMap: any; + heightmaps: any; + biomes: any; + chunkData: any; + blockEntities: any; + } | /** 1.18 */ { + x: number; + z: number; + heightmaps: any; + chunkData: any; + blockEntities: any; + trustEdges: boolean; + skyLightMask: any; + blockLightMask: any; + emptySkyLightMask: any; + emptyBlockLightMask: any; + skyLight: any; + blockLight: any; + } | /** 1.20 */ { + x: number; + z: number; + heightmaps: any; + chunkData: any; + blockEntities: any; + skyLightMask: any; + blockLightMask: any; + emptySkyLightMask: any; + emptyBlockLightMask: any; + skyLight: any; + blockLight: any; + }; + multi_block_change: /** 1.7 */ { + chunkX: number; + chunkZ: number; + recordCount: any; + dataLength: number; + records: any; + } | /** 1.8 */ { + chunkX: number; + chunkZ: number; + records: any; + } | /** 1.16.2 */ { + chunkCoordinates: any; + notTrustEdges: boolean; + records: any; + } | /** 1.19.2 */ { + chunkCoordinates: any; + suppressLightUpdates: boolean; + records: any; + } | /** 1.20 */ { + chunkCoordinates: any; + records: any; + }; + block_change: /** 1.7 */ { + location: any; + type: number; + metadata: number; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + type: number; + }; + block_action: /** 1.7 */ { + location: any; + byte1: number; + byte2: number; + blockId: number; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + byte1: number; + byte2: number; + blockId: number; + }; + block_break_animation: /** 1.7 */ { + entityId: number; + location: any; + destroyStage: number; + } | /** 1.8 */ { + entityId: number; + location: { x: number, y: number, z: number }; + destroyStage: number; + }; + /** Removed in 1.9 */ + map_chunk_bulk: /** 1.7 */ { + chunkColumnCount: any; + dataLength: any; + skyLightSent: boolean; + compressedChunkData: any; + meta: any; + } | /** 1.8 */ { + skyLightSent: boolean; + meta: any; + data: any; + }; + explosion: /** 1.7 */ { + x: number; + y: number; + z: number; + radius: number; + affectedBlockOffsets: any; + playerMotionX: number; + playerMotionY: number; + playerMotionZ: number; + }; + world_event: /** 1.7 */ { + effectId: number; + location: any; + data: number; + global: boolean; + } | /** 1.8 */ { + effectId: number; + location: { x: number, y: number, z: number }; + data: number; + global: boolean; + }; + /** Removed in 1.19.3 */ + named_sound_effect: /** 1.7 */ { + soundName: string; + x: number; + y: number; + z: number; + volume: number; + pitch: number; + } | /** 1.9 */ { + soundName: string; + soundCategory: number; + x: number; + y: number; + z: number; + volume: number; + pitch: number; + } | /** 1.19 */ { + soundName: string; + soundCategory: number; + x: number; + y: number; + z: number; + volume: number; + pitch: number; + seed: bigint; + }; + world_particles: /** 1.7 */ { + particleName: string; + x: number; + y: number; + z: number; + offsetX: number; + offsetY: number; + offsetZ: number; + particleData: number; + particles: number; + } | /** 1.8 */ { + particleId: number; + longDistance: boolean; + x: number; + y: number; + z: number; + offsetX: number; + offsetY: number; + offsetZ: number; + particleData: number; + particles: number; + data: any; + }; + game_state_change: /** 1.7 */ { + reason: number; + gameMode: number; + }; + /** Removed in 1.16 */ + spawn_entity_weather: /** 1.7 */ { + entityId: number; + type: number; + x: number; + y: number; + z: number; + }; + open_window: /** 1.7 */ { + windowId: number; + inventoryType: number; + windowTitle: string; + slotCount: number; + useProvidedTitle: boolean; + entityId: any; + } | /** 1.8 */ { + windowId: number; + inventoryType: string; + windowTitle: string; + slotCount: number; + entityId: any; + } | /** 1.14 */ { + windowId: number; + inventoryType: number; + windowTitle: string; + }; + close_window: /** 1.7 */ { + windowId: number; + }; + set_slot: /** 1.7 */ { + windowId: number; + slot: number; + item: any; + } | /** 1.17.1 */ { + windowId: number; + stateId: number; + slot: number; + item: any; + }; + window_items: /** 1.7 */ { + windowId: number; + items: any; + } | /** 1.17.1 */ { + windowId: number; + stateId: number; + items: any; + carriedItem: any; + }; + craft_progress_bar: /** 1.7 */ { + windowId: number; + property: number; + value: number; + }; + /** Removed in 1.17 */ + transaction: /** 1.7 */ { + windowId: number; + action: number; + accepted: boolean; + }; + /** Removed in 1.9.4 */ + update_sign: /** 1.7 */ { + location: any; + text1: string; + text2: string; + text3: string; + text4: string; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + text1: string; + text2: string; + text3: string; + text4: string; + }; + map: /** 1.7 */ { + itemDamage: number; + data: any; + } | /** 1.8 */ { + itemDamage: number; + scale: number; + icons: any; + columns: number; + rows: any; + x: any; + y: any; + data: any; + } | /** 1.9 */ { + itemDamage: number; + scale: number; + trackingPosition: boolean; + icons: any; + columns: number; + rows: any; + x: any; + y: any; + data: any; + } | /** 1.14 */ { + itemDamage: number; + scale: number; + trackingPosition: boolean; + locked: boolean; + icons: any; + columns: number; + rows: any; + x: any; + y: any; + data: any; + } | /** 1.17 */ { + itemDamage: number; + scale: number; + locked: boolean; + icons: any; + columns: number; + rows: any; + x: any; + y: any; + data: any; + }; + tile_entity_data: /** 1.7 */ { + location: any; + action: number; + nbtData: any; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + action: number; + nbtData: any; + }; + open_sign_entity: /** 1.7 */ { + location: any; + } | /** 1.8 */ { + location: { x: number, y: number, z: number }; + } | /** 1.20 */ { + location: { x: number, y: number, z: number }; + isFrontText: boolean; + }; + statistics: /** 1.7 */ { + entries: any; + }; + player_info: /** 1.7 */ { + playerName: string; + online: boolean; + ping: number; + } | /** 1.8 */ { + action: number; + data: any; + }; + abilities: /** 1.7 */ { + flags: number; + flyingSpeed: number; + walkingSpeed: number; + }; + tab_complete: /** 1.7 */ { + matches: any; + } | /** 1.13 */ { + transactionId: number; + start: number; + length: number; + matches: any; + }; + scoreboard_objective: /** 1.7 */ { + name: string; + displayText: string; + action: number; + } | /** 1.8 */ { + name: string; + action: number; + displayText: any; + type: any; + }; + scoreboard_score: /** 1.7 */ { + itemName: string; + action: number; + scoreName: any; + value: any; + } | /** 1.8 */ { + itemName: string; + action: number; + scoreName: string; + value: any; + }; + scoreboard_display_objective: /** 1.7 */ { + position: number; + name: string; + }; + /** Removed in 1.9 */ + scoreboard_team: /** 1.7 */ { + team: string; + mode: number; + name: any; + prefix: any; + suffix: any; + friendlyFire: any; + players: any; + } | /** 1.8 */ { + team: string; + mode: number; + name: any; + prefix: any; + suffix: any; + friendlyFire: any; + nameTagVisibility: any; + color: any; + players: any; + }; + custom_payload: /** 1.7 */ { + channel: string; + data: any; + }; + kick_disconnect: /** 1.7 */ { + reason: string; + }; + packet: /** 1.7 */ { + name: any; + params: any; + }; + difficulty: /** 1.8 */ { + difficulty: number; + } | /** 1.14 */ { + difficulty: number; + difficultyLocked: boolean; + }; + /** Removed in 1.17 */ + combat_event: /** 1.8 */ { + event: number; + duration: any; + playerId: any; + entityId: any; + message: any; + }; + camera: /** 1.8 */ { + cameraId: number; + }; + /** Removed in 1.17 */ + world_border: /** 1.8 */ { + action: number; + radius: any; + x: any; + z: any; + old_radius: any; + new_radius: any; + speed: any; + portalBoundary: any; + warning_time: any; + warning_blocks: any; + }; + /** Removed in 1.17 */ + title: /** 1.8 */ { + action: number; + text: any; + fadeIn: any; + stay: any; + fadeOut: any; + }; + /** Removed in 1.9 */ + set_compression: /** 1.8 */ { + threshold: number; + }; + playerlist_header: /** 1.8 */ { + header: string; + footer: string; + }; + resource_pack_send: /** 1.8 */ { + url: string; + hash: string; + } | /** 1.17 */ { + url: string; + hash: string; + forced: boolean; + promptMessage: any; + }; + /** Removed in 1.9 */ + update_entity_nbt: /** 1.8 */ { + entityId: number; + tag: any; + }; + boss_bar: /** 1.9 */ { + entityUUID: any; + action: number; + title: any; + health: any; + color: any; + dividers: any; + flags: any; + }; + set_cooldown: /** 1.9 */ { + itemID: number; + cooldownTicks: number; + }; + unload_chunk: /** 1.9 */ { + chunkX: number; + chunkZ: number; + }; + vehicle_move: /** 1.9 */ { + x: number; + y: number; + z: number; + yaw: number; + pitch: number; + }; + set_passengers: /** 1.9 */ { + entityId: number; + passengers: any; + }; + teams: /** 1.9 */ { + team: string; + mode: number; + name: any; + prefix: any; + suffix: any; + friendlyFire: any; + nameTagVisibility: any; + collisionRule: any; + color: any; + players: any; + } | /** 1.13 */ { + team: string; + mode: number; + name: any; + friendlyFire: any; + nameTagVisibility: any; + collisionRule: any; + formatting: any; + prefix: any; + suffix: any; + players: any; + }; + sound_effect: /** 1.9 */ { + soundId: number; + soundCategory: number; + x: number; + y: number; + z: number; + volume: number; + pitch: number; + } | /** 1.19 */ { + soundId: number; + soundCategory: number; + x: number; + y: number; + z: number; + volume: number; + pitch: number; + seed: bigint; + }; + entity_update_attributes: /** 1.9 */ { + entityId: number; + properties: any; + }; + advancements: /** 1.12 */ { + reset: boolean; + advancementMapping: any; + identifiers: any; + progressMapping: any; + }; + unlock_recipes: /** 1.12 */ { + action: number; + craftingBookOpen: boolean; + filteringCraftable: boolean; + recipes1: any; + recipes2: any; + } | /** 1.13 */ { + action: number; + craftingBookOpen: boolean; + filteringCraftable: boolean; + smeltingBookOpen: boolean; + filteringSmeltable: boolean; + recipes1: any; + recipes2: any; + } | /** 1.16.2 */ { + action: number; + craftingBookOpen: boolean; + filteringCraftable: boolean; + smeltingBookOpen: boolean; + filteringSmeltable: boolean; + blastFurnaceOpen: boolean; + filteringBlastFurnace: boolean; + smokerBookOpen: boolean; + filteringSmoker: boolean; + recipes1: any; + recipes2: any; + }; + select_advancement_tab: /** 1.12 */ { + id: any; + }; + craft_recipe_response: /** 1.12.1 */ { + windowId: number; + recipe: number; + } | /** 1.13 */ { + windowId: number; + recipe: string; + }; + declare_commands: /** 1.13 */ { + nodes: any; + rootIndex: number; + }; + face_player: /** 1.13 */ { + feet_eyes: number; + x: number; + y: number; + z: number; + isEntity: boolean; + entityId: any; + entity_feet_eyes: any; + }; + nbt_query_response: /** 1.13 */ { + transactionId: number; + nbt: any; + }; + stop_sound: /** 1.13 */ { + flags: number; + source: any; + sound: any; + }; + declare_recipes: /** 1.13 */ { + recipes: any; + }; + tags: /** 1.13 */ { + blockTags: any; + itemTags: any; + fluidTags: any; + } | /** 1.14 */ { + blockTags: any; + itemTags: any; + fluidTags: any; + entityTags: any; + } | /** 1.17 */ { + tags: any; + }; + open_horse_window: /** 1.14 */ { + windowId: number; + nbSlots: number; + entityId: number; + }; + update_light: /** 1.14 */ { + chunkX: number; + chunkZ: number; + skyLightMask: number; + blockLightMask: number; + emptySkyLightMask: number; + emptyBlockLightMask: number; + data: any; + } | /** 1.16 */ { + chunkX: number; + chunkZ: number; + trustEdges: boolean; + skyLightMask: number; + blockLightMask: number; + emptySkyLightMask: number; + emptyBlockLightMask: number; + data: any; + } | /** 1.17 */ { + chunkX: number; + chunkZ: number; + trustEdges: boolean; + skyLightMask: any; + blockLightMask: any; + emptySkyLightMask: any; + emptyBlockLightMask: any; + skyLight: any; + blockLight: any; + } | /** 1.20 */ { + chunkX: number; + chunkZ: number; + skyLightMask: any; + blockLightMask: any; + emptySkyLightMask: any; + emptyBlockLightMask: any; + skyLight: any; + blockLight: any; + }; + trade_list: /** 1.14 */ { + windowId: number; + trades: any; + villagerLevel: number; + experience: number; + isRegularVillager: boolean; + } | /** 1.14.3 */ { + windowId: number; + trades: any; + villagerLevel: number; + experience: number; + isRegularVillager: boolean; + canRestock: boolean; + }; + open_book: /** 1.14 */ { + hand: number; + }; + update_view_position: /** 1.14 */ { + chunkX: number; + chunkZ: number; + }; + update_view_distance: /** 1.14 */ { + viewDistance: number; + }; + entity_sound_effect: /** 1.14 */ { + soundId: number; + soundCategory: number; + entityId: number; + volume: number; + pitch: number; + } | /** 1.19.2 */ { + soundId: number; + soundCategory: number; + entityId: number; + volume: number; + pitch: number; + seed: bigint; + }; + acknowledge_player_digging: /** 1.14.4 */ { + location: { x: number, y: number, z: number }; + block: number; + status: number; + successful: boolean; + } | /** 1.19 */ { + sequenceId: number; + }; + end_combat_event: /** 1.17 */ { + duration: number; + entityId: number; + } | /** 1.20 */ { + duration: number; + }; + enter_combat_event: /** 1.17 */ { + + }; + death_combat_event: /** 1.17 */ { + playerId: number; + entityId: number; + message: string; + } | /** 1.20 */ { + playerId: number; + message: string; + }; + /** Removed in 1.17.1 */ + destroy_entity: /** 1.17 */ { + entityId: number; + }; + /** Removed in 1.19 */ + sculk_vibration_signal: /** 1.17 */ { + sourcePosition: { x: number, y: number, z: number }; + destinationIdentifier: string; + destination: any; + arrivalTicks: number; + }; + clear_titles: /** 1.17 */ { + reset: boolean; + }; + initialize_world_border: /** 1.17 */ { + x: number; + z: number; + oldDiameter: number; + newDiameter: number; + speed: any; + portalTeleportBoundary: number; + warningBlocks: number; + warningTime: number; + } | /** 1.19 */ { + x: number; + z: number; + oldDiameter: number; + newDiameter: number; + speed: number; + portalTeleportBoundary: number; + warningBlocks: number; + warningTime: number; + }; + action_bar: /** 1.17 */ { + text: string; + }; + world_border_center: /** 1.17 */ { + x: number; + z: number; + }; + world_border_lerp_size: /** 1.17 */ { + oldDiameter: number; + newDiameter: number; + speed: any; + } | /** 1.19 */ { + oldDiameter: number; + newDiameter: number; + speed: number; + }; + world_border_size: /** 1.17 */ { + diameter: number; + }; + world_border_warning_delay: /** 1.17 */ { + warningTime: number; + }; + world_border_warning_reach: /** 1.17 */ { + warningBlocks: number; + }; + ping: /** 1.17 */ { + id: number; + }; + set_title_subtitle: /** 1.17 */ { + text: string; + }; + set_title_text: /** 1.17 */ { + text: string; + }; + set_title_time: /** 1.17 */ { + fadeIn: number; + stay: number; + fadeOut: number; + }; + simulation_distance: /** 1.18 */ { + distance: number; + }; + /** Removed in 1.19.3 */ + chat_preview: /** 1.19 */ { + queryId: number; + message: any; + }; + player_chat: /** 1.19 */ { + signedChatContent: string; + unsignedChatContent: any; + type: number; + senderUuid: any; + senderName: string; + senderTeam: any; + timestamp: bigint; + salt: bigint; + signature: any; + } | /** 1.19.2 */ { + previousSignature: any; + senderUuid: any; + signature: any; + plainMessage: string; + formattedMessage: any; + timestamp: bigint; + salt: bigint; + previousMessages: any; + unsignedContent: any; + filterType: number; + filterTypeMask: any; + type: number; + networkName: string; + networkTargetName: any; + } | /** 1.19.3 */ { + senderUuid: any; + index: number; + signature: any; + plainMessage: string; + timestamp: bigint; + salt: bigint; + previousMessages: any; + unsignedChatContent: any; + filterType: number; + filterTypeMask: any; + type: number; + networkName: string; + networkTargetName: any; + }; + /** Removed in 1.19.3 */ + should_display_chat_preview: /** 1.19 */ { + should_display_chat_preview: boolean; + }; + system_chat: /** 1.19 */ { + content: string; + type: number; + } | /** 1.19.2 */ { + content: string; + isActionBar: boolean; + }; + server_data: /** 1.19 */ { + motd: any; + icon: any; + previewsChat: boolean; + } | /** 1.19.2 */ { + motd: any; + icon: any; + previewsChat: boolean; + enforcesSecureChat: boolean; + } | /** 1.19.3 */ { + motd: any; + icon: any; + enforcesSecureChat: boolean; + } | /** 1.19.4 */ { + motd: string; + iconBytes: any; + enforcesSecureChat: boolean; + }; + chat_suggestions: /** 1.19.2 */ { + action: number; + entries: any; + }; + hide_message: /** 1.19.2 */ { + signature: any; + } | /** 1.19.3 */ { + id: number; + signature: any; + }; + /** Removed in 1.19.3 */ + message_header: /** 1.19.2 */ { + previousSignature: any; + senderUuid: any; + signature: any; + messageHash: any; + }; + profileless_chat: /** 1.19.3 */ { + message: string; + type: number; + name: string; + target: any; + }; + player_remove: /** 1.19.3 */ { + players: any; + }; + feature_flags: /** 1.19.3 */ { + features: any; + }; + chunk_biomes: /** 1.19.4 */ { + biomes: any; + }; + damage_event: /** 1.19.4 */ { + entityId: number; + sourceTypeId: number; + sourceCauseId: any; + sourceDirectId: any; + sourcePosition: any; + }; + hurt_animation: /** 1.19.4 */ { + entityId: number; + yaw: number; + }; +} diff --git a/src/globalDomListeners.ts b/src/globalDomListeners.ts new file mode 100644 index 00000000..866c9784 --- /dev/null +++ b/src/globalDomListeners.ts @@ -0,0 +1,35 @@ +import { saveServer } from './flyingSquidUtils' +import { isGameActive, activeModalStack } from './globalState' +import { options } from './optionsStorage' + +window.addEventListener('unload', (e) => { + if (!window.justReloaded) { + sessionStorage.justReloaded = false + } + void saveServer() +}) + +document.addEventListener('visibilitychange', () => { + if (document.visibilityState === 'hidden') void saveServer() +}) +document.addEventListener('blur', () => { + void saveServer() +}) + +window.addEventListener('beforeunload', (event) => { + if (!window.justReloaded) { + sessionStorage.justReloaded = false + } + + // todo-low maybe exclude chat? + if (!isGameActive(true) && activeModalStack.at(-1)?.elem?.id !== 'chat') return + if (sessionStorage.lastReload && !options.preventDevReloadWhilePlaying) return + if (!options.closeConfirmation) return + + // For major browsers doning only this is enough + event.preventDefault() + + // Display a confirmation prompt + event.returnValue = '' // Required for some browsers + return 'The game is running. Are you sure you want to close this page?' +}) diff --git a/src/globalState.ts b/src/globalState.ts index 7b6985a3..adaf4361 100644 --- a/src/globalState.ts +++ b/src/globalState.ts @@ -2,10 +2,7 @@ import { proxy, ref, subscribe } from 'valtio' import { pointerLock } from './utils' -import { options } from './optionsStorage' import type { OptionsGroupType } from './optionsGuiScheme' -import { saveServer } from './flyingSquidUtils' -import { fsState } from './loadSave' // todo: refactor structure with support of hideNext=false @@ -141,20 +138,10 @@ export const miscUiState = proxy({ loadedDataVersion: null as string | null, appLoaded: false, usingGamepadInput: false, - appConfig: null as AppConfig | null + appConfig: null as AppConfig | null, + displaySearchInput: false, }) -export const resetStateAfterDisconnect = () => { - miscUiState.gameLoaded = false - miscUiState.loadedDataVersion = null - miscUiState.singleplayer = false - miscUiState.flyingSquid = false - miscUiState.wanOpened = false - miscUiState.currentDisplayQr = null - - fsState.saveLoaded = false -} - export const isGameActive = (foregroundCheck: boolean) => { if (foregroundCheck && activeModalStack.length) return false return miscUiState.gameLoaded @@ -185,38 +172,3 @@ export const showNotification = (newNotification: Partial) } // todo restore auto-save on interval for player data! (or implement it in flying squid since there is already auto-save for world) - -window.addEventListener('unload', (e) => { - if (!window.justReloaded) { - sessionStorage.justReloaded = false - } - void saveServer() -}) - -document.addEventListener('visibilitychange', () => { - if (document.visibilityState === 'hidden') void saveServer() -}) -document.addEventListener('blur', () => { - void saveServer() -}) - -window.inspectPlayer = () => require('fs').promises.readFile('/world/playerdata/9e487d23-2ffc-365a-b1f8-f38203f59233.dat').then(window.nbt.parse).then(console.log) - -// todo move from global state -window.addEventListener('beforeunload', (event) => { - if (!window.justReloaded) { - sessionStorage.justReloaded = false - } - - // todo-low maybe exclude chat? - if (!isGameActive(true) && activeModalStack.at(-1)?.elem?.id !== 'chat') return - if (sessionStorage.lastReload && !options.preventDevReloadWhilePlaying) return - if (!options.closeConfirmation) return - - // For major browsers doning only this is enough - event.preventDefault() - - // Display a confirmation prompt - event.returnValue = '' // Required for some browsers - return 'The game is running. Are you sure you want to close this page?' -}) diff --git a/src/globals.d.ts b/src/globals.d.ts index 2f6acb5a..6affacf7 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -2,7 +2,12 @@ declare const THREE: typeof import('three') // todo make optional -declare const bot: Omit & { world: import('prismarine-world').world.WorldSync } +declare const bot: Omit & { + world: import('prismarine-world').world.WorldSync + _client: import('minecraft-protocol').Client & { + write: typeof import('./generatedClientPackets').clientWrite + } +} declare const __type_bot: typeof bot declare const viewer: import('prismarine-viewer/viewer/lib/viewer').Viewer declare const worldView: import('prismarine-viewer/viewer/lib/worldDataEmitter').WorldDataEmitter | undefined @@ -15,6 +20,7 @@ declare const customEvents: import('typed-emitter').default<{ singleplayer (): void digStart () gameLoaded (): void + search (q: string): void }> declare const beforeRenderFrame: Array<() => void> @@ -65,3 +71,11 @@ declare module '*.png' { const png: string export default png } + +interface PromiseConstructor { + withResolvers (): { + resolve: (value: T) => void; + reject: (reason: any) => void; + promise: Promise; + } +} diff --git a/src/importsWorkaround.js b/src/importsWorkaround.js index 33815d6b..21bc4585 100644 --- a/src/importsWorkaround.js +++ b/src/importsWorkaround.js @@ -1,2 +1,7 @@ // workaround for mineflayer process.versions.node = '18.0.0' + +if (!navigator.getGamepads) { + console.warn('navigator.getGamepads is not available, adding a workaround') + navigator.getGamepads ??= () => [] +} diff --git a/src/index.ts b/src/index.ts index 2c58ca3a..35110274 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import './globals' import 'iconify-icon' import './devtools' import './entities' +import './globalDomListeners' import initCollisionShapes from './getCollisionShapes' import { onGameLoad } from './playerWindows' import { supportedVersions } from 'minecraft-protocol' @@ -22,6 +23,8 @@ import './menus/hud' import './menus/play_screen' import './menus/pause_screen' import './menus/keybinds_screen' +import 'core-js/features/array/at' +import 'core-js/features/promise/with-resolvers' import { initWithRenderer, statsEnd, statsStart } from './topRightStats' import PrismarineBlock from 'prismarine-block' import WebGpuRenderer from 'THREE/examples/jsm/renderers/webgpu/WebGPURenderer.js' @@ -30,7 +33,7 @@ import { options, watchValue } from './optionsStorage' import './reactUi.jsx' import { contro, onBotCreate } from './controls' import './dragndrop' -import { possiblyCleanHandle } from './browserfs' +import { possiblyCleanHandle, resetStateAfterDisconnect } from './browserfs' import './eruda' import { watchOptionsAfterViewerInit } from './watchOptions' import downloadAndOpenFile from './downloadAndOpenFile' @@ -55,10 +58,11 @@ import { showModal, activeModalStacks, insertActiveModalStack, isGameActive, - miscUiState, resetStateAfterDisconnect, + miscUiState, notification } from './globalState' + import { pointerLock, toMajorVersion, @@ -87,9 +91,12 @@ import { loadInMemorySave } from './react/SingleplayerProvider' // side effects import { downloadSoundsIfNeeded } from './soundSystem' +import { ua } from './react/utils' +import { handleMovementStickDelta, joystickPointer } from './react/TouchAreasControls' window.debug = debug window.THREE = THREE +window.worldInteractions = worldInteractions window.beforeRenderFrame = [] // ACTUAL CODE @@ -106,11 +113,19 @@ const renderer = new WebGpuRenderer({ }) as any initWithRenderer(renderer.domElement) window.renderer = renderer -renderer.setPixelRatio(window.devicePixelRatio || 1) // todo this value is too high on ios, need to check, probably we should use avg, also need to make it configurable +let pixelRatio = window.devicePixelRatio || 1 // todo this value is too high on ios, need to check, probably we should use avg, also need to make it configurable +if (!renderer.capabilities.isWebGL2) pixelRatio = 1 // webgl1 has issues with high pixel ratio (sometimes screen is clipped) +renderer.setPixelRatio(pixelRatio) renderer.setSize(window.innerWidth, window.innerHeight) renderer.domElement.id = 'viewer-canvas' document.body.appendChild(renderer.domElement) +const isFirefox = ua.getBrowser().name === 'Firefox' +if (isFirefox) { + // set custom property + document.body.style.setProperty('--thin-if-firefox', 'thin') +} + // Create viewer const viewer: import('prismarine-viewer/viewer/lib/viewer').Viewer = new Viewer(renderer, options.numWorkers) window.viewer = viewer @@ -119,6 +134,11 @@ Object.defineProperty(window, 'debugSceneChunks', { return viewer.world.getLoadedChunksRelative(bot.entity.position) }, }) +Object.defineProperty(window, 'debugSceneChunksY', { + get () { + return viewer.world.getLoadedChunksRelative(bot.entity.position, true) + }, +}) viewer.entities.entitiesOptions = { fontFamily: 'mojangles' } @@ -331,12 +351,12 @@ async function connect (connectOptions: { } const handleError = (err) => { errorAbortController.abort() - console.log('Encountered error!', err) + if (isCypress()) throw err + if (miscUiState.gameLoaded) return setLoadingScreenStatus(`Error encountered. ${err}`, true) onPossibleErrorDisconnect() destroyAll() - if (isCypress()) throw err } const errorAbortController = new AbortController() @@ -651,6 +671,7 @@ async function connect (connectOptions: { let screenTouches = 0 let capturedPointer: { id; x; y; sourceX; sourceY; activateCameraMove; time } | undefined registerListener(document, 'pointerdown', (e) => { + const usingJoystick = options.touchControlsType === 'joystick-buttons' const clickedEl = e.composedPath()[0] if (!isGameActive(true) || !miscUiState.currentTouch || clickedEl !== cameraControlEl || e.pointerId === undefined) { return @@ -660,6 +681,16 @@ async function connect (connectOptions: { // todo needs fixing! // window.dispatchEvent(new MouseEvent('mousedown', { button: 1 })) } + if (usingJoystick) { + if (!joystickPointer.pointer && e.clientX < window.innerWidth / 2) { + joystickPointer.pointer = { + pointerId: e.pointerId, + x: e.clientX, + y: e.clientY + } + return + } + } if (capturedPointer) { return } @@ -673,19 +704,33 @@ async function connect (connectOptions: { activateCameraMove: false, time: Date.now() } - virtualClickTimeout ??= setTimeout(() => { - virtualClickActive = true - document.dispatchEvent(new MouseEvent('mousedown', { button: 0 })) - }, touchStartBreakingBlockMs) + if (options.touchControlsType !== 'joystick-buttons') { + virtualClickTimeout ??= setTimeout(() => { + virtualClickActive = true + document.dispatchEvent(new MouseEvent('mousedown', { button: 0 })) + }, touchStartBreakingBlockMs) + } }) registerListener(document, 'pointermove', (e) => { - if (e.pointerId === undefined || e.pointerId !== capturedPointer?.id) return + if (e.pointerId === undefined) return + const supportsPressure = (e as any).pressure !== undefined && (e as any).pressure !== 0 && (e as any).pressure !== 0.5 && (e as any).pressure !== 1 && (e.pointerType === 'touch' || e.pointerType === 'pen') + if (e.pointerId === joystickPointer.pointer?.pointerId) { + handleMovementStickDelta(e) + if (supportsPressure && (e as any).pressure > 0.5) { + bot.setControlState('sprint', true) + // todo + } + return + } + if (e.pointerId !== capturedPointer?.id) return window.scrollTo(0, 0) e.preventDefault() e.stopPropagation() const allowedJitter = 1.1 - // todo support .pressure (3d touch) + if (supportsPressure) { + bot.setControlState('jump', (e as any).pressure > 0.5) + } const xDiff = Math.abs(e.pageX - capturedPointer.sourceX) > allowedJitter const yDiff = Math.abs(e.pageY - capturedPointer.sourceY) > allowedJitter if (!capturedPointer.activateCameraMove && (xDiff || yDiff)) capturedPointer.activateCameraMove = true @@ -698,18 +743,26 @@ async function connect (connectOptions: { }, { passive: false }) const pointerUpHandler = (e: PointerEvent) => { - if (e.pointerId === undefined || e.pointerId !== capturedPointer?.id) return + if (e.pointerId === undefined) return + if (e.pointerId === joystickPointer.pointer?.pointerId) { + handleMovementStickDelta() + joystickPointer.pointer = null + return + } + if (e.pointerId !== capturedPointer?.id) return clearTimeout(virtualClickTimeout) virtualClickTimeout = undefined - if (virtualClickActive) { - // button 0 is left click - document.dispatchEvent(new MouseEvent('mouseup', { button: 0 })) - virtualClickActive = false - } else if (!capturedPointer.activateCameraMove && (Date.now() - capturedPointer.time < touchStartBreakingBlockMs)) { - document.dispatchEvent(new MouseEvent('mousedown', { button: 2 })) - worldInteractions.update() - document.dispatchEvent(new MouseEvent('mouseup', { button: 2 })) + if (options.touchControlsType !== 'joystick-buttons') { + if (virtualClickActive) { + // button 0 is left click + document.dispatchEvent(new MouseEvent('mouseup', { button: 0 })) + virtualClickActive = false + } else if (!capturedPointer.activateCameraMove && (Date.now() - capturedPointer.time < touchStartBreakingBlockMs)) { + document.dispatchEvent(new MouseEvent('mousedown', { button: 2 })) + worldInteractions.update() + document.dispatchEvent(new MouseEvent('mouseup', { button: 2 })) + } } capturedPointer = undefined screenTouches-- diff --git a/src/loadSave.ts b/src/loadSave.ts index cb04fbd1..d8531344 100644 --- a/src/loadSave.ts +++ b/src/loadSave.ts @@ -4,11 +4,11 @@ import * as nbt from 'prismarine-nbt' import { proxy } from 'valtio' import { gzip } from 'node-gzip' import { options } from './optionsStorage' -import { nameToMcOfflineUUID } from './flyingSquidUtils' +import { nameToMcOfflineUUID, disconnect } from './flyingSquidUtils' import { forceCachedDataPaths } from './browserfs' -import { disconnect, isMajorVersionGreater } from './utils' -import { activeModalStack, activeModalStacks, hideModal, insertActiveModalStack, miscUiState } from './globalState' -import { appStatusState } from './react/AppStatusProvider' +import { isMajorVersionGreater } from './utils' + +import { activeModalStacks, insertActiveModalStack, miscUiState } from './globalState' // todo include name of opened handle (zip)! // additional fs metadata diff --git a/src/menus/components/common.js b/src/menus/components/common.js index 5ad74faf..83c74abd 100644 --- a/src/menus/components/common.js +++ b/src/menus/components/common.js @@ -30,7 +30,7 @@ const commonCss = css` /** @returns {boolean} */ function isMobile () { - return window.matchMedia('(pointer: coarse)').matches + return window.matchMedia('(pointer: coarse)').matches || navigator.userAgent.includes('Mobile') } // todo there are better workarounds and proper way to detect notch @@ -48,7 +48,7 @@ function openURL (url, newTab = true) { if (newTab) { window.open(url, '_blank', 'noopener,noreferrer') } else { - window.open(url) + window.open(url, '_self') } } diff --git a/src/menus/components/health_bar.js b/src/menus/components/health_bar.js index 8b9947ad..c49c510b 100644 --- a/src/menus/components/health_bar.js +++ b/src/menus/components/health_bar.js @@ -93,11 +93,15 @@ class HealthBar extends LitElement { } effectAdded (effect) { - this.shadowRoot.querySelector('#health').classList.add(getEffectClass(effect)) + const effectClass = getEffectClass(effect) + if (!effectClass) return + this.shadowRoot.querySelector('#health').classList.add(effectClass) } effectEnded (effect) { - this.shadowRoot.querySelector('#health').classList.remove(getEffectClass(effect)) + const effectClass = getEffectClass(effect) + if (!effectClass) return + this.shadowRoot.querySelector('#health').classList.remove(effectClass) } onDamage () { diff --git a/src/menus/hud.js b/src/menus/hud.js index 9aef54ef..17537e0e 100644 --- a/src/menus/hud.js +++ b/src/menus/hud.js @@ -117,12 +117,8 @@ class Hud extends LitElement { this.isReady = true window.dispatchEvent(new CustomEvent('hud-ready', { detail: this })) - watchValue(options, (o) => { - miscUiState.currentTouch = o.alwaysShowMobileControls || isMobile() - this.showMobileControls(miscUiState.currentTouch) - }) - watchValue(miscUiState, o => { + this.showMobileControls(o.currentTouch) //@ts-expect-error this.shadowRoot.host.style.display = o.gameLoaded ? 'block' : 'none' }) diff --git a/src/menus/pause_screen.js b/src/menus/pause_screen.js index f8042ea5..ce376645 100644 --- a/src/menus/pause_screen.js +++ b/src/menus/pause_screen.js @@ -4,7 +4,8 @@ const { subscribe } = require('valtio') const { subscribeKey } = require('valtio/utils') const { hideCurrentModal, showModal, miscUiState, notification, openOptionsMenu } = require('../globalState') const { fsState } = require('../loadSave') -const { disconnect, openGithub } = require('../utils') +const { openGithub } = require('../utils') +const { disconnect } = require('../flyingSquidUtils') const { closeWan, openToWanAndCopyJoinLink, getJoinLink } = require('../localServerMultiplayer') const { uniqueFileNameFromWorldName, copyFilesAsyncWithProgress } = require('../browserfs') const { showOptionsModal } = require('../react/SelectOption') diff --git a/src/optionsGuiScheme.tsx b/src/optionsGuiScheme.tsx index 6fcbf68b..c0b64979 100644 --- a/src/optionsGuiScheme.tsx +++ b/src/optionsGuiScheme.tsx @@ -6,9 +6,10 @@ import { AppOptions, options } from './optionsStorage' import Button from './react/Button' import { OptionMeta, OptionSlider } from './react/OptionsItems' import Slider from './react/Slider' -import { getScreenRefreshRate, openFilePicker, setLoadingScreenStatus } from './utils' +import { getScreenRefreshRate, setLoadingScreenStatus } from './utils' +import { openFilePicker, resetLocalStorageWithoutWorld } from './browserfs' import { getResourcePackName, resourcePackState, uninstallTexturePack } from './texturePack' -import { resetLocalStorageWithoutWorld } from './browserfs' + export const guiOptionsScheme: { [t in OptionsGroupType]: Array<{ [K in keyof AppOptions]?: Partial> } & { custom?}> @@ -44,11 +45,7 @@ export const guiOptionsScheme: { }, { custom () { - return <> -
- Experimental -
- + return Experimental }, dayCycleAndLighting: { text: 'Day Cycle', @@ -138,6 +135,9 @@ export const guiOptionsScheme: { unit: '', delayApply: true, }, + custom () { + return Chat + }, chatWidth: { max: 320, unit: 'px', @@ -150,6 +150,8 @@ export const guiOptionsScheme: { }, chatOpacityOpened: { }, + chatSelect: { + }, } ], controls: [ @@ -186,7 +188,16 @@ export const guiOptionsScheme: { }, touchButtonsPosition: { max: 80 - } + }, + touchControlsType: { + values: [['classic', 'Classic'], ['joystick-buttons', 'New']], + }, + }, + { + custom () { + const { touchControlsType } = useSnapshot(options) + return + + } + +} + +const MineIcon = () => { + return + + +} diff --git a/src/react/TouchAreasControlsProvider.tsx b/src/react/TouchAreasControlsProvider.tsx new file mode 100644 index 00000000..7de8eaca --- /dev/null +++ b/src/react/TouchAreasControlsProvider.tsx @@ -0,0 +1,19 @@ +import { useSnapshot } from 'valtio' +import { activeModalStack, hideModal } from '../globalState' +import { options } from '../optionsStorage' +import TouchAreasControls from './TouchAreasControls' +import { useIsModalActive, useUsingTouch } from './utils' + +export default () => { + const usingTouch = useUsingTouch() + const hasModals = useSnapshot(activeModalStack).length !== 0 + const setupActive = useIsModalActive('touch-buttons-setup') + const { touchControlsPositions, touchControlsType } = useSnapshot(options) + + return { + if (newPositions) { + options.touchControlsPositions = newPositions + } + hideModal() + }} /> +} diff --git a/src/react/TouchControls.tsx b/src/react/TouchControls.tsx index bb9296da..db71ae1f 100644 --- a/src/react/TouchControls.tsx +++ b/src/react/TouchControls.tsx @@ -1,9 +1,10 @@ -import { LeftTouchArea, RightTouchArea, useInterfaceState, useUsingTouch } from '@dimaka/interface' +import { LeftTouchArea, RightTouchArea, useInterfaceState } from '@dimaka/interface' import { css } from '@emotion/css' import { useSnapshot } from 'valtio' import { contro } from '../controls' import { miscUiState, activeModalStack } from '../globalState' import { watchValue, options } from '../optionsStorage' +import { useUsingTouch } from './utils' // todo useInterfaceState.setState({ @@ -48,8 +49,9 @@ export default () => { const usingTouch = useUsingTouch() const { usingGamepadInput } = useSnapshot(miscUiState) const modals = useSnapshot(activeModalStack) + const { touchControlsType } = useSnapshot(options) - if (!usingTouch || usingGamepadInput) return null + if (!usingTouch || usingGamepadInput || touchControlsType !== 'classic') return null return (
{ return useSnapshot(activeModalStack).at(-1)?.reactType === modal @@ -25,3 +26,11 @@ export function useDidUpdateEffect (fn, inputs) { } }, inputs) } + +export const useUsingTouch = () => { + return useSnapshot(miscUiState).currentTouch +} + +export const ua = new UAParser(navigator.userAgent) + +export const isIos = ua.getOS().name === 'iOS' diff --git a/src/reactUi.tsx b/src/reactUi.tsx index 1566c2bc..e3f630b5 100644 --- a/src/reactUi.tsx +++ b/src/reactUi.tsx @@ -18,6 +18,8 @@ import SoundMuffler from './react/SoundMuffler' import TouchControls from './react/TouchControls' import widgets from './react/widgets' import { useIsWidgetActive } from './react/utils' +import GlobalSearchInput from './GlobalSearchInput' +import TouchAreasControlsProvider from './react/TouchAreasControlsProvider' const Portal = ({ children, to }) => { return createPortal(children, to) @@ -58,11 +60,13 @@ const InGameUi = () => { + {/* becaues of z-index */} + } diff --git a/src/screens.css b/src/screens.css index c04945ca..c4e7fe9b 100644 --- a/src/screens.css +++ b/src/screens.css @@ -15,6 +15,7 @@ .backdrop { position: fixed; inset: 0; + height: 100dvh; background: rgba(0, 0, 0, 0.75); } diff --git a/src/styles.css b/src/styles.css index 58758400..64fc054d 100644 --- a/src/styles.css +++ b/src/styles.css @@ -51,6 +51,7 @@ body { -ms-user-select: none; user-select: none; font-family: minecraft, mojangles, monospace; + z-index: -5; } #react-root { @@ -148,10 +149,21 @@ body { animation-fill-mode: forwards; } +.full-svg svg { + width: 100%; + height: 100%; +} + .muted { color: #999; } +@media screen and (min-width: 430px) { + .span-2 { + grid-column: span 2; + } +} + @keyframes dive-animation { 0% { transform: translateZ(-150px); diff --git a/src/texturePack.ts b/src/texturePack.ts index 321ce104..3af09a87 100644 --- a/src/texturePack.ts +++ b/src/texturePack.ts @@ -76,7 +76,7 @@ export const installTexturePack = async (file: File | ArrayBuffer, name = file[' const allFilesArr = Object.entries(zipFile.files) let done = 0 const upStatus = () => { - setLoadingScreenStatus(`${status} ${Math.round(++done / allFilesArr.length * 100)}%`) + setLoadingScreenStatus(`${status} ${Math.round(done / allFilesArr.length * 100)}%`) } await Promise.all(allFilesArr.map(async ([path, file]) => { const writePath = join(texturePackBasePath, path) diff --git a/src/topRightStats.ts b/src/topRightStats.ts index 5692e4c9..e1d3f62a 100644 --- a/src/topRightStats.ts +++ b/src/topRightStats.ts @@ -18,6 +18,7 @@ const addStat = (dom, size = 80) => { if (denseMode) dom.style.height = '12px' dom.style.overflow = 'hidden' dom.style.left = '' + dom.style.top = 0 dom.style.right = `${total}px` dom.style.width = '80px' dom.style.zIndex = 1000 @@ -45,7 +46,7 @@ if (hideStats) { export const initWithRenderer = (canvas) => { if (hideStats) return statsGl.init(canvas) - if (statsGl.gpuPanel) { + if (statsGl.gpuPanel && process.env.NODE_ENV !== 'production') { addStatsGlStat(statsGl.gpuPanel.canvas) } // addStatsGlStat(statsGl.msPanel.canvas) diff --git a/src/utils.ts b/src/utils.ts index 4f3a18bd..e8658acf 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,9 +1,6 @@ import { hideModal, isGameActive, miscUiState, notification, showModal } from './globalState' import { options } from './optionsStorage' -import { openWorldZip } from './browserfs' -import { installTexturePack } from './texturePack' import { appStatusState } from './react/AppStatusProvider' -import { saveServer } from './flyingSquidUtils' export const goFullscreen = async (doToggle = false) => { if (!document.fullscreenElement) { @@ -147,17 +144,6 @@ export const setLoadingScreenStatus = function (status: string | undefined | nul appStatusState.status = status } - -export const disconnect = async () => { - if (localServer) { - await saveServer() - //@ts-expect-error todo expose! - void localServer.quit() // todo investigate we should await - } - window.history.replaceState({}, '', `${window.location.pathname}`) // remove qs - bot.end('You left the server') -} - // doesn't support snapshots export const toMajorVersion = (version) => { const [a, b] = (String(version)).split('.') @@ -181,35 +167,6 @@ export const reloadChunks = async () => { await worldView.updatePosition(bot.entity.position, true) } -export const openFilePicker = (specificCase?: 'resourcepack') => { - // create and show input picker - let picker: HTMLInputElement = document.body.querySelector('input#file-zip-picker')! - if (!picker) { - picker = document.createElement('input') - picker.type = 'file' - picker.accept = '.zip' - - picker.addEventListener('change', () => { - const file = picker.files?.[0] - picker.value = '' - if (!file) return - if (!file.name.endsWith('.zip')) { - const doContinue = confirm(`Are you sure ${file.name.slice(-20)} is .zip file? Only .zip files are supported. Continue?`) - if (!doContinue) return - } - if (specificCase === 'resourcepack') { - void installTexturePack(file) - } else { - void openWorldZip(file) - } - }) - picker.hidden = true - document.body.appendChild(picker) - } - - picker.click() -} - export const openGithub = () => { window.open(process.env.GITHUB_URL, '_blank') } @@ -230,3 +187,11 @@ export function assertDefined (x: T | undefined): asserts x is T { export const haveDirectoryPicker = () => { return !!window.showDirectoryPicker } + +const reportedWarnings = new Set() + +export const reportWarningOnce = (id: string, message: string) => { + if (reportedWarnings.has(id)) return + reportedWarnings.add(id) + console.warn(message) +} diff --git a/src/watchOptions.ts b/src/watchOptions.ts index 9b22fdfe..a6eea6e7 100644 --- a/src/watchOptions.ts +++ b/src/watchOptions.ts @@ -3,6 +3,8 @@ import { subscribeKey } from 'valtio/utils' import { options, watchValue } from './optionsStorage' import { reloadChunks } from './utils' +import { miscUiState } from './globalState' +import { isMobile } from './menus/components/common' subscribeKey(options, 'renderDistance', reloadChunks) subscribeKey(options, 'multiplayerRenderDistance', reloadChunks) @@ -14,7 +16,17 @@ watchValue(options, o => { document.documentElement.style.setProperty('--guiScale', `${o.guiScale}`) }) +/** happens once */ export const watchOptionsAfterViewerInit = () => { + const updateTouch = (o) => { + miscUiState.currentTouch = o.alwaysShowMobileControls || isMobile() + } + + watchValue(options, updateTouch) + window.matchMedia('(pointer: coarse)').addEventListener('change', (e) => { + updateTouch(options) + }) + watchValue(options, o => { if (!viewer) return viewer.world.showChunkBorders = o.showChunkBorders