This commit is contained in:
Vitaly 2024-03-02 23:01:17 +03:00 committed by GitHub
commit e722135925
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 138 additions and 68 deletions

View file

@ -4,7 +4,7 @@ env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches: [main]
branches: [release]
jobs:
build-and-deploy:
runs-on: ubuntu-latest

View file

@ -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

View file

@ -1,7 +1,7 @@
{
"version": 1,
"defaultHost": "<from-proxy>",
"defaultProxy": "zardoy.site:2344",
"defaultProxy": "proxy.mcraft.fun",
"defaultVersion": "1.18.2",
"mapsProvider": "https://maps.mcraft.fun/"
}

View file

@ -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.61.0",
"minecraft-data": "3.61.2",
"net-browserify": "github:zardoy/prismarinejs-net-browserify",
"node-gzip": "^1.1.2",
"peerjs": "^1.5.0",
@ -64,6 +65,7 @@
"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",
@ -83,7 +85,7 @@
"@types/lodash-es": "^4.17.9",
"@types/react-transition-group": "^4.4.7",
"@types/stats.js": "^0.17.1",
"@types/three": "0.128.0",
"@types/three": "0.154.0",
"@types/ua-parser-js": "^0.7.39",
"@xmcl/installer": "^5.1.0",
"assert": "^2.0.0",
@ -113,7 +115,7 @@
"rimraf": "^5.0.1",
"storybook": "^7.4.6",
"stream-browserify": "^3.0.0",
"three": "0.128.0",
"three": "0.154.0",
"timers-browserify": "^2.0.12",
"typescript": "^5.2.2",
"use-typed-event-listener": "^4.0.2",
@ -125,11 +127,11 @@
},
"pnpm": {
"overrides": {
"three": "0.128.0",
"three": "0.154.0",
"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.61.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"

126
pnpm-lock.yaml generated
View file

@ -5,11 +5,11 @@ settings:
excludeLinksFromLockfile: false
overrides:
three: 0.128.0
three: 0.154.0
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.61.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.61.0
version: 3.61.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
@ -186,8 +192,8 @@ importers:
specifier: ^0.17.1
version: 0.17.1
'@types/three':
specifier: 0.128.0
version: 0.128.0
specifier: 0.154.0
version: 0.154.0
'@types/ua-parser-js':
specifier: ^0.7.39
version: 0.7.39
@ -276,8 +282,8 @@ importers:
specifier: ^3.0.0
version: 3.0.0
three:
specifier: 0.128.0
version: 0.128.0
specifier: 0.154.0
version: 0.154.0
timers-browserify:
specifier: ^2.0.12
version: 2.0.12
@ -331,7 +337,7 @@ importers:
version: github.com/zardoy/prismarine-block/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0
prismarine-chunk:
specifier: ^1.22.0
version: 1.35.0(minecraft-data@3.61.0)
version: 1.35.0(minecraft-data@3.61.2)
prismarine-schematic:
specifier: ^1.2.0
version: 1.2.3
@ -349,7 +355,7 @@ importers:
version: 4.7.2
three-stdlib:
specifier: ^2.26.11
version: 2.28.5(three@0.128.0)
version: 2.28.5(three@0.154.0)
three.meshline:
specifier: ^1.3.0
version: 1.4.0
@ -3304,6 +3310,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'}
@ -4871,6 +4894,10 @@ packages:
dev: false
optional: true
/@tweenjs/tween.js@18.6.4:
resolution: {integrity: sha512-lB9lMjuqjtuJrx7/kOkqQBtllspPIN+96OvTCeJ2j5FEzinoAXTdAMFnDAQT1KVPRlnYfBrqxtqP66vDM40xxQ==}
dev: true
/@tweenjs/tween.js@20.0.3:
resolution: {integrity: sha512-SYUe1UgY5HM05EB4+0B4arq2IPjvyzKXoklXKxSYrc2IFxGm1cBrqg5XbiB5uwbs0xY5j+rj986NAJMM0KZaUw==}
dev: false
@ -5211,8 +5238,15 @@ packages:
/@types/stats.js@0.17.1:
resolution: {integrity: sha512-OgfYE1x2w1jRUXzzKABX+kOdwz2y9PE0uSwnZabkWfJTWOzm7Pvfm4JI2xqRE0q2nwUe2jZLWcrcnhd9lQU63w==}
/@types/three@0.128.0:
resolution: {integrity: sha512-Jwq5XYUkzAcPTo34hlGAQGUyAI0b2F3aCCFWG/v7ZhJBEG5HGcusMSr70GhDlT8Gs0f02QnSPZ2RCA1MrCOa/w==}
/@types/three@0.154.0:
resolution: {integrity: sha512-IioqpGhch6FdLDh4zazRn3rXHj6Vn2nVOziJdXVbJFi9CaI65LtP9qqUtpzbsHK2Ezlox8NtsLNHSw3AQzucjA==}
dependencies:
'@tweenjs/tween.js': 18.6.4
'@types/stats.js': 0.17.1
'@types/webxr': 0.5.7
fflate: 0.6.10
lil-gui: 0.17.0
meshoptimizer: 0.18.1
dev: true
/@types/three@0.156.0:
@ -5237,7 +5271,6 @@ packages:
/@types/webxr@0.5.7:
resolution: {integrity: sha512-Rcgs5c2eNFnHp53YOjgtKfl/zWX1Y+uFGUwlSXrWcZWu3yhANRezmph4MninmqybUYT6g9ZE0aQ9QIdPkLR3Kg==}
dev: false
/@types/wicg-file-system-access@2023.10.2:
resolution: {integrity: sha512-nSiK8qt0O7sQmDcW3HYfvya7GDoD6ipgdcUFzk3QN+UBIqXeNg38Nh6VnKv7EIPfkVETRiquyMskCbpxUzgX1Q==}
@ -5612,18 +5645,18 @@ packages:
exit-hook: 2.2.1
flatmap: 0.0.3
long: 5.2.3
minecraft-data: 3.61.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.61.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.61.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
@ -7431,6 +7464,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:
@ -8720,7 +8754,6 @@ packages:
/fflate@0.6.10:
resolution: {integrity: sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg==}
dev: false
/figures@3.2.0:
resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==}
@ -10429,6 +10462,10 @@ packages:
immediate: 3.0.6
dev: false
/lil-gui@0.17.0:
resolution: {integrity: sha512-MVBHmgY+uEbmJNApAaPbtvNh1RCAeMnKym82SBjtp5rODTYKWtM+MXHCifLe2H2Ti1HuBGBtK/5SyG4ShQ3pUQ==}
dev: true
/lil-gui@0.18.2:
resolution: {integrity: sha512-DgdrLy3/KGC0PiQLKgOcJMPItP4xY4iWgJ9+91Zaxfr8GCTmMps05QS9w9jW7yspILlbscbquwjOwxmWnSx5Uw==}
dev: false
@ -10823,7 +10860,6 @@ packages:
/meshoptimizer@0.18.1:
resolution: {integrity: sha512-ZhoIoL7TNV4s5B6+rx5mC//fw8/POGyNxS/DZyCJeiZ12ScLfVwRE/GfsxwiTkMYYD5DmK2/JXnEVXqL4rF+Sw==}
dev: false
/methods@1.1.2:
resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==}
@ -10895,8 +10931,8 @@ packages:
resolution: {integrity: sha512-/eMxh3LNjCXOnU6KnQMjBM8dRnoJNpWIg7mD2m2RthraYiQK2FNzPWIKxWm2j3Ufcf5nzFXupgABledE86r4fQ==}
dev: false
/minecraft-data@3.61.0:
resolution: {integrity: sha512-e7FMplGNjhAZvdxT66bP56ZqHymr+BrzCZlhNxRr1suFKueGSTQQA+DZ2ZU/vW/02dBFCrHfBEJh1sw5vOZ+Ew==}
/minecraft-data@3.61.2:
resolution: {integrity: sha512-4RsP5rkQx78ZaOKWGeVidc+PjH+DFzNFrQMtSVAgabDOHDWrhSaOlpkxpltHy+vYUyLhglfAkc2g1DUkgHQcTQ==}
/minecraft-folder-path@1.2.0:
resolution: {integrity: sha512-qaUSbKWoOsH9brn0JQuBhxNAzTDMwrOXorwuRxdJKKKDYvZhtml+6GVCUrY5HRiEsieBEjCUnhVpDuQiKsiFaw==}
@ -10932,7 +10968,7 @@ packages:
/mineflayer-pathfinder@2.4.4:
resolution: {integrity: sha512-HAXakZrJRb1UC+5dv8EaDrqjW3ZnBnBk3nkb6x/YWyhHCUKn/E7VU0FO+UN9whuqPlkSaVumEdXJdydE6lSYxQ==}
dependencies:
minecraft-data: 3.61.0
minecraft-data: 3.61.2
prismarine-block: github.com/zardoy/prismarine-block/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0
prismarine-entity: 2.3.1
prismarine-item: 1.14.0
@ -12026,13 +12062,13 @@ packages:
- encoding
- supports-color
/prismarine-biome@1.3.0(minecraft-data@3.61.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.61.0
minecraft-data: 3.61.2
prismarine-registry: ^1.1.0
dependencies:
minecraft-data: 3.61.0
minecraft-data: 3.61.2
prismarine-registry: 1.7.0
/prismarine-chat@1.9.1:
@ -12043,11 +12079,11 @@ packages:
prismarine-nbt: 2.5.0
prismarine-registry: 1.7.0
/prismarine-chunk@1.35.0(minecraft-data@3.61.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.61.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
@ -12085,7 +12121,7 @@ packages:
/prismarine-physics@1.8.0:
resolution: {integrity: sha512-gbM+S+bmVtOKVv+Z0WGaHMeEeBHISIDsRDRlv8sr0dex3ZJRhuq8djA02CBreguXtI18ZKh6q3TSj2qDr45NHA==}
dependencies:
minecraft-data: 3.61.0
minecraft-data: 3.61.2
prismarine-nbt: 2.5.0
vec3: 0.1.8
dev: true
@ -12110,13 +12146,13 @@ packages:
/prismarine-registry@1.7.0:
resolution: {integrity: sha512-yyva0FpWI078nNeMhx8ekVza5uUTYhEv+C+ADu3wUQXiG8qhXkvrf0uzsnhTgZL8BLdsi2axgCEiKw9qSKIuxQ==}
dependencies:
minecraft-data: 3.61.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.61.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
@ -13331,7 +13367,7 @@ packages:
dependencies:
'@types/three': 0.156.0
skinview-utils: 0.7.1
three: 0.128.0
three: 0.154.0
dev: false
/slash@3.0.0:
@ -13952,10 +13988,10 @@ packages:
any-promise: 1.3.0
dev: false
/three-stdlib@2.28.5(three@0.128.0):
/three-stdlib@2.28.5(three@0.154.0):
resolution: {integrity: sha512-JdLMhkpT+1ZWeQPyKQNW1zqUwISI2hsUljS6u3vB9lp5EvwsayaAzGnbVeR35895udOF+zxcTiQY3psk+qqlxg==}
peerDependencies:
three: 0.128.0
three: 0.154.0
dependencies:
'@types/draco3d': 1.4.7
'@types/offscreencanvas': 2019.7.2
@ -13963,15 +13999,15 @@ packages:
draco3d: 1.5.6
fflate: 0.6.10
potpack: 1.0.2
three: 0.128.0
three: 0.154.0
dev: false
/three.meshline@1.4.0:
resolution: {integrity: sha512-A8IsiMrWP8zmHisGDAJ76ZD7t/dOF/oCe/FUKNE6Bu01ZYEx8N6IlU/1Plb2aOZtAuWM2A8s8qS3hvY0OFuvOw==}
dev: false
/three@0.128.0:
resolution: {integrity: sha512-i0ap/E+OaSfzw7bD1TtYnPo3VEplkl70WX5fZqZnfZsE3k3aSFudqrrC9ldFZfYFkn1zwDmBcdGfiIm/hnbyZA==}
/three@0.154.0:
resolution: {integrity: sha512-Uzz8C/5GesJzv8i+Y2prEMYUwodwZySPcNhuJUdsVMH2Yn4Nm8qlbQe6qRN5fOhg55XB0WiLfTPBxVHxpE60ug==}
/throttle-debounce@3.0.1:
resolution: {integrity: sha512-dTEWWNu6JmeVXY0ZYoPuH5cRIwc0MeGbJwah9KUNYSJwommQpCzTySTpEe8Gs1J23aeWEuAobe4Ag7EHVt/LOg==}
@ -15326,12 +15362,12 @@ packages:
version: 4.19.0
engines: {node: '>=18'}
dependencies:
minecraft-data: 3.61.0
minecraft-data: 3.61.2
minecraft-protocol: github.com/zardoy/minecraft-protocol/2c14a686bfe7cbd9a5c87b629b402295ee86219f
prismarine-biome: 1.3.0(minecraft-data@3.61.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.61.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
@ -15368,8 +15404,8 @@ packages:
name: diamond-square
version: 1.3.0
dependencies:
minecraft-data: 3.61.0
prismarine-chunk: 1.35.0(minecraft-data@3.61.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
@ -15399,7 +15435,7 @@ packages:
endian-toggle: 0.0.0
lodash.get: 4.4.2
lodash.merge: 4.6.2
minecraft-data: 3.61.0
minecraft-data: 3.61.2
minecraft-folder-path: 1.2.0
node-fetch: 2.7.0
node-rsa: 0.4.2
@ -15419,20 +15455,20 @@ packages:
name: prismarine-block
version: 1.17.1
dependencies:
minecraft-data: 3.61.0
prismarine-biome: 1.3.0(minecraft-data@3.61.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.61.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.61.0)
prismarine-chunk: 1.35.0(minecraft-data@3.61.2)
prismarine-nbt: 2.5.0
uint4: 0.1.2
vec3: 0.1.8

View file

@ -15,7 +15,7 @@ import Entity from '../viewer/lib/entity/Entity'
globalThis.THREE = THREE
//@ts-ignore
require('three/examples/js/controls/OrbitControls')
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
const gui = new GUI()
@ -291,7 +291,7 @@ async function main () {
//@ts-ignore
const controls = new globalThis.THREE.OrbitControls(viewer.camera, renderer.domElement)
const controls = new OrbitControls(viewer.camera, renderer.domElement)
controls.target.set(targetPos.x + 0.5, targetPos.y + 0.5, targetPos.z + 0.5)
const cameraPos = targetPos.offset(2, 2, 2)

View file

@ -191,7 +191,7 @@ function getMesh (texture, jsonModel, overrides = {}) {
geometry.setAttribute('skinWeight', new THREE.Float32BufferAttribute(geoData.skinWeights, 4))
geometry.setIndex(geoData.indices)
const material = new THREE.MeshLambertMaterial({ transparent: true, skinning: true, alphaTest: 0.1 })
const material = new THREE.MeshLambertMaterial({ transparent: true, alphaTest: 0.1 })
const mesh = new THREE.SkinnedMesh(geometry, material)
mesh.add(...rootBones)
mesh.bind(skeleton)

View file

@ -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]
}

View file

@ -29,7 +29,12 @@ export class Viewer {
renderPass: RenderPass
constructor(public renderer: THREE.WebGLRenderer, numWorkers?: number, public enableFXAA = false) {
// https://discourse.threejs.org/t/updates-to-color-management-in-three-js-r152/50791
THREE.ColorManagement.enabled = false
renderer.outputColorSpace = THREE.LinearSRGBColorSpace
this.scene = new THREE.Scene()
this.scene.matrixAutoUpdate = false // for perf
this.resetScene()
if (this.enableFXAA) {
this.enableFxaaScene()

View file

@ -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
@ -274,12 +274,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]
}))
}

View file

@ -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<string, string>
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) => {

View file

@ -139,6 +139,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'
}