Compare commits
1 commit
next
...
improve-da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f9d4bc894 |
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
description: Restricts usage of the global Mineflayer `bot` variable to only src/ files; prohibits usage in renderer/. Specifies correct usage of player state and appViewer globals.
|
||||
globs: src/**/*.ts,renderer/**/*.ts
|
||||
alwaysApply: false
|
||||
---
|
||||
Ask AI
|
||||
|
||||
- The global variable `bot` refers to the Mineflayer bot instance.
|
||||
- You may use `bot` directly in any file under the `src/` directory (e.g., `src/mineflayer/playerState.ts`).
|
||||
- Do **not** use `bot` directly in any file under the `renderer/` directory or its subfolders (e.g., `renderer/viewer/three/worldrendererThree.ts`).
|
||||
- In renderer code, all bot/player state and events must be accessed via explicit interfaces, state managers, or passed-in objects, never by referencing `bot` directly.
|
||||
- In renderer code (such as in `WorldRendererThree`), use the `playerState` property (e.g., `worldRenderer.playerState.gameMode`) to access player state. The implementation for `playerState` lives in `src/mineflayer/playerState.ts`.
|
||||
- In `src/` code, you may use the global variable `appViewer` from `src/appViewer.ts` directly. Do **not** import `appViewer` or use `window.appViewer`; use the global `appViewer` variable as-is.
|
||||
- Some other global variables that can be used without window prefixes are listed in src/globals.d.ts
|
||||
|
||||
Rationale: This ensures a clean separation between the Mineflayer logic (server-side/game logic) and the renderer (client-side/view logic), making the renderer portable and testable, and maintains proper usage of global state.
|
||||
|
||||
For more general project contributing guides see CONTRIBUTING.md on like how to setup the project. Use pnpm tsc if needed to validate result with typechecking the whole project.
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
# we dont want default config to be loaded in the dockerfile, but rather using a volume
|
||||
config.json
|
||||
# build stuff
|
||||
node_modules
|
||||
public
|
||||
|
|
@ -1,9 +1 @@
|
|||
node_modules
|
||||
rsbuild.config.ts
|
||||
*.module.css.d.ts
|
||||
*.generated.ts
|
||||
generated
|
||||
dist
|
||||
public
|
||||
**/*/rsbuildSharedConfig.ts
|
||||
src/mcDataTypes.ts
|
||||
159
.eslintrc.json
|
|
@ -1,76 +1,32 @@
|
|||
{
|
||||
"extends": [
|
||||
"zardoy",
|
||||
"plugin:@stylistic/disable-legacy"
|
||||
],
|
||||
"extends": "zardoy",
|
||||
"ignorePatterns": [
|
||||
"!*.js"
|
||||
],
|
||||
"plugins": [
|
||||
"@stylistic"
|
||||
"!*.js",
|
||||
"prismarine-viewer/"
|
||||
],
|
||||
"rules": {
|
||||
// style
|
||||
"@stylistic/space-infix-ops": "error",
|
||||
"@stylistic/no-multi-spaces": "error",
|
||||
"@stylistic/no-trailing-spaces": "error",
|
||||
"@stylistic/space-before-function-paren": "error",
|
||||
"@stylistic/array-bracket-spacing": "error",
|
||||
// would be great to have but breaks TS code like (url?) => ...
|
||||
// "@stylistic/arrow-parens": [
|
||||
// "error",
|
||||
// "as-needed"
|
||||
// ],
|
||||
"@stylistic/arrow-spacing": "error",
|
||||
"@stylistic/block-spacing": "error",
|
||||
"@typescript-eslint/no-this-alias": "off",
|
||||
"@stylistic/brace-style": [
|
||||
"error",
|
||||
"1tbs",
|
||||
{
|
||||
"allowSingleLine": true
|
||||
}
|
||||
],
|
||||
// too annoying to be forced to multi-line, probably should be enforced to never
|
||||
// "@stylistic/comma-dangle": [
|
||||
// "error",
|
||||
// "always-multiline"
|
||||
// ],
|
||||
"@stylistic/computed-property-spacing": "error",
|
||||
"@stylistic/dot-location": [
|
||||
"error",
|
||||
"property"
|
||||
],
|
||||
"@stylistic/eol-last": "error",
|
||||
"@stylistic/function-call-spacing": "error",
|
||||
"@stylistic/function-paren-newline": [
|
||||
"error",
|
||||
"consistent"
|
||||
],
|
||||
"@stylistic/generator-star-spacing": "error",
|
||||
"@stylistic/implicit-arrow-linebreak": "error",
|
||||
"@stylistic/indent-binary-ops": [
|
||||
"error",
|
||||
2
|
||||
],
|
||||
"@stylistic/function-call-argument-newline": [
|
||||
"error",
|
||||
"consistent"
|
||||
],
|
||||
"@stylistic/space-in-parens": [
|
||||
"space-infix-ops": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"space-before-function-paren": "error",
|
||||
"space-in-parens": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"@stylistic/object-curly-spacing": [
|
||||
"object-curly-spacing": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"@stylistic/comma-spacing": "error",
|
||||
"@stylistic/semi": [
|
||||
"comma-spacing": "error",
|
||||
"semi": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"@stylistic/indent": [
|
||||
"comma-dangle": [
|
||||
"error",
|
||||
// todo maybe "always-multiline"?
|
||||
"only-multiline"
|
||||
],
|
||||
"indent": [
|
||||
"error",
|
||||
2,
|
||||
{
|
||||
|
|
@ -80,72 +36,13 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"@stylistic/quotes": [
|
||||
"quotes": [
|
||||
"error",
|
||||
"single",
|
||||
{
|
||||
"allowTemplateLiterals": true
|
||||
}
|
||||
],
|
||||
"@stylistic/key-spacing": "error",
|
||||
"@stylistic/keyword-spacing": "error",
|
||||
// "@stylistic/line-comment-position": "error", // not needed
|
||||
// "@stylistic/lines-around-comment": "error", // also not sure if needed
|
||||
// "@stylistic/max-len": "error", // also not sure if needed
|
||||
// "@stylistic/linebreak-style": "error", // let git decide
|
||||
"@stylistic/max-statements-per-line": [
|
||||
"error",
|
||||
{
|
||||
"max": 5
|
||||
}
|
||||
],
|
||||
// "@stylistic/member-delimiter-style": "error",
|
||||
// "@stylistic/multiline-ternary": "error", // not needed
|
||||
// "@stylistic/newline-per-chained-call": "error", // not sure if needed
|
||||
"@stylistic/new-parens": "error",
|
||||
"@typescript-eslint/class-literal-property-style": "off",
|
||||
"@stylistic/no-confusing-arrow": "error",
|
||||
"@stylistic/wrap-iife": "error",
|
||||
"@stylistic/space-before-blocks": "error",
|
||||
"@stylistic/type-generic-spacing": "error",
|
||||
"@stylistic/template-tag-spacing": "error",
|
||||
"@stylistic/template-curly-spacing": "error",
|
||||
"@stylistic/type-annotation-spacing": "error",
|
||||
"@stylistic/jsx-child-element-spacing": "error",
|
||||
// buggy
|
||||
// "@stylistic/jsx-closing-bracket-location": "error",
|
||||
// "@stylistic/jsx-closing-tag-location": "error",
|
||||
"@stylistic/jsx-curly-brace-presence": "error",
|
||||
"@stylistic/jsx-curly-newline": "error",
|
||||
"@stylistic/jsx-curly-spacing": "error",
|
||||
"@stylistic/jsx-equals-spacing": "error",
|
||||
"@stylistic/jsx-first-prop-new-line": "error",
|
||||
"@stylistic/jsx-function-call-newline": "error",
|
||||
"@stylistic/jsx-max-props-per-line": [
|
||||
"error",
|
||||
{
|
||||
"maximum": 7
|
||||
}
|
||||
],
|
||||
"@stylistic/jsx-pascal-case": "error",
|
||||
"@stylistic/jsx-props-no-multi-spaces": "error",
|
||||
"@stylistic/jsx-self-closing-comp": "error",
|
||||
// "@stylistic/jsx-sort-props": [
|
||||
// "error",
|
||||
// {
|
||||
// "callbacksLast": false,
|
||||
// "shorthandFirst": true,
|
||||
// "shorthandLast": false,
|
||||
// "multiline": "ignore",
|
||||
// "ignoreCase": true,
|
||||
// "noSortAlphabetically": true,
|
||||
// "reservedFirst": [
|
||||
// "key",
|
||||
// "className"
|
||||
// ],
|
||||
// "locale": "auto"
|
||||
// }
|
||||
// ],
|
||||
// perf
|
||||
"import/no-deprecated": "off",
|
||||
// ---
|
||||
|
|
@ -155,7 +52,6 @@
|
|||
// intentional: improve readability in some cases
|
||||
"no-else-return": "off",
|
||||
"@typescript-eslint/padding-line-between-statements": "off",
|
||||
"@typescript-eslint/no-dynamic-delete": "off",
|
||||
"arrow-body-style": "off",
|
||||
"unicorn/prefer-ternary": "off",
|
||||
"unicorn/switch-case-braces": "off",
|
||||
|
|
@ -192,32 +88,13 @@
|
|||
"@typescript-eslint/no-confusing-void-expression": "off",
|
||||
"unicorn/no-empty-file": "off",
|
||||
"unicorn/prefer-event-target": "off",
|
||||
"@typescript-eslint/member-ordering": "off",
|
||||
// needs to be fixed actually
|
||||
"complexity": "off",
|
||||
"@typescript-eslint/no-floating-promises": "warn",
|
||||
"no-async-promise-executor": "off",
|
||||
"no-bitwise": "off",
|
||||
"unicorn/filename-case": "off",
|
||||
"max-depth": "off",
|
||||
"unicorn/no-typeof-undefined": "off"
|
||||
"max-depth": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.js"
|
||||
],
|
||||
"rules": {
|
||||
"@stylistic/space-before-function-paren": [
|
||||
"error",
|
||||
{
|
||||
"anonymous": "always",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"root": true
|
||||
}
|
||||
|
|
|
|||
59
.github/workflows/benchmark.yml
vendored
|
|
@ -1,59 +0,0 @@
|
|||
name: Benchmark
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
push:
|
||||
branches:
|
||||
- perf-test
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: >-
|
||||
(github.event_name == 'push' && github.ref == 'refs/heads/perf-test') ||
|
||||
(
|
||||
github.event_name == 'issue_comment' &&
|
||||
github.event.issue.pull_request != '' &&
|
||||
(startsWith(github.event.comment.body, '/benchmark'))
|
||||
)
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- run: lscpu
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: "pnpm"
|
||||
- name: Move Cypress to dependencies
|
||||
run: |
|
||||
jq '.dependencies.cypress = .optionalDependencies.cypress | del(.optionalDependencies.cypress)' package.json > package.json.tmp
|
||||
mv package.json.tmp package.json
|
||||
- run: pnpm install --no-frozen-lockfile
|
||||
|
||||
- run: pnpm build
|
||||
- run: nohup pnpm prod-start &
|
||||
|
||||
- run: pnpm test:benchmark
|
||||
id: benchmark
|
||||
continue-on-error: true
|
||||
# read benchmark results from stdout
|
||||
- run: |
|
||||
if [ -f benchmark.txt ]; then
|
||||
# Format the benchmark results for GitHub comment
|
||||
BENCHMARK_RESULT=$(cat benchmark.txt | sed 's/^/- /')
|
||||
echo "BENCHMARK_RESULT<<EOF" >> $GITHUB_ENV
|
||||
echo "$BENCHMARK_RESULT" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
else
|
||||
echo "BENCHMARK_RESULT=Benchmark failed to run or produce results" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- uses: mshick/add-pr-comment@v2
|
||||
with:
|
||||
allow-repeats: true
|
||||
message: |
|
||||
Benchmark result: ${{ env.BENCHMARK_RESULT }}
|
||||
33
.github/workflows/build-single-file.yml
vendored
|
|
@ -1,33 +0,0 @@
|
|||
name: build-single-file
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-bundle:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@master
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build single-file version - minecraft.html
|
||||
run: pnpm build-single-file && mv dist/single/index.html minecraft.html
|
||||
env:
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: minecraft.html
|
||||
path: minecraft.html
|
||||
45
.github/workflows/build-zip.yml
vendored
|
|
@ -1,45 +0,0 @@
|
|||
name: Make Self Host Zip
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-bundle:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@master
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build project
|
||||
run: pnpm build
|
||||
env:
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
|
||||
- name: Bundle server.js
|
||||
run: |
|
||||
pnpm esbuild server.js --bundle --platform=node --outfile=bundled-server.js --define:process.env.NODE_ENV="'production'"
|
||||
|
||||
- name: Create distribution package
|
||||
run: |
|
||||
mkdir -p package
|
||||
cp -r dist package/
|
||||
cp bundled-server.js package/server.js
|
||||
cd package
|
||||
zip -r ../self-host.zip .
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: self-host
|
||||
path: self-host.zip
|
||||
161
.github/workflows/ci.yml
vendored
|
|
@ -8,170 +8,19 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@master
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v1.4.3
|
||||
with:
|
||||
java-version: 17
|
||||
java-package: jre
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
# cache: "pnpm"
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
run: npm i -g pnpm
|
||||
# todo this needs investigating fixing
|
||||
- run: pnpm install
|
||||
- run: pnpm build-single-file
|
||||
- name: Store minecraft.html size
|
||||
run: |
|
||||
SIZE_BYTES=$(du -s dist/single/minecraft.html 2>/dev/null | cut -f1)
|
||||
echo "SIZE_BYTES=$SIZE_BYTES" >> $GITHUB_ENV
|
||||
- run: pnpm check-build
|
||||
- name: Create zip package for size comparison
|
||||
run: |
|
||||
mkdir -p package
|
||||
cp -r dist package/
|
||||
cd package
|
||||
zip -r ../self-host.zip .
|
||||
- run: pnpm build-playground
|
||||
# - run: pnpm build-storybook
|
||||
- run: pnpm test-unit
|
||||
- run: pnpm lint
|
||||
|
||||
- name: Parse Bundle Stats
|
||||
run: |
|
||||
GZIP_BYTES=$(du -s self-host.zip 2>/dev/null | cut -f1)
|
||||
SIZE=$(echo "scale=2; $SIZE_BYTES/1024/1024" | bc)
|
||||
GZIP_SIZE=$(echo "scale=2; $GZIP_BYTES/1024/1024" | bc)
|
||||
echo "{\"total\": ${SIZE}, \"gzipped\": ${GZIP_SIZE}}" > /tmp/bundle-stats.json
|
||||
|
||||
# - name: Compare Bundle Stats
|
||||
# id: compare
|
||||
# uses: actions/github-script@v6
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GIST_TOKEN }}
|
||||
# with:
|
||||
# script: |
|
||||
# const gistId = '${{ secrets.BUNDLE_STATS_GIST_ID }}';
|
||||
|
||||
# async function getGistContent() {
|
||||
# const { data } = await github.rest.gists.get({
|
||||
# gist_id: gistId,
|
||||
# headers: {
|
||||
# authorization: `token ${process.env.GITHUB_TOKEN}`
|
||||
# }
|
||||
# });
|
||||
# return JSON.parse(data.files['bundle-stats.json'].content || '{}');
|
||||
# }
|
||||
|
||||
# const content = await getGistContent();
|
||||
# const baseStats = content['${{ github.event.pull_request.base.ref }}'];
|
||||
# const newStats = require('/tmp/bundle-stats.json');
|
||||
|
||||
# const comparison = `minecraft.html (normal build gzip)\n${baseStats.total}MB (${baseStats.gzipped}MB compressed) -> ${newStats.total}MB (${newStats.gzipped}MB compressed)`;
|
||||
# core.setOutput('stats', comparison);
|
||||
|
||||
# - run: pnpm tsx scripts/buildNpmReact.ts
|
||||
- run: pnpm check-build
|
||||
- run: nohup pnpm prod-start &
|
||||
- run: nohup pnpm test-mc-server &
|
||||
- uses: cypress-io/github-action@v5
|
||||
with:
|
||||
install: false
|
||||
- uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: cypress-images
|
||||
path: cypress/screenshots/
|
||||
# - run: node scripts/outdatedGitPackages.mjs
|
||||
# if: ${{ github.event.pull_request.base.ref == 'release' }}
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# - name: Store Bundle Stats
|
||||
# if: github.event.pull_request.base.ref == 'next'
|
||||
# uses: actions/github-script@v6
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GIST_TOKEN }}
|
||||
# with:
|
||||
# script: |
|
||||
# const gistId = '${{ secrets.BUNDLE_STATS_GIST_ID }}';
|
||||
|
||||
# async function getGistContent() {
|
||||
# const { data } = await github.rest.gists.get({
|
||||
# gist_id: gistId,
|
||||
# headers: {
|
||||
# authorization: `token ${process.env.GITHUB_TOKEN}`
|
||||
# }
|
||||
# });
|
||||
# return JSON.parse(data.files['bundle-stats.json'].content || '{}');
|
||||
# }
|
||||
|
||||
# async function updateGistContent(content) {
|
||||
# await github.rest.gists.update({
|
||||
# gist_id: gistId,
|
||||
# headers: {
|
||||
# authorization: `token ${process.env.GITHUB_TOKEN}`
|
||||
# },
|
||||
# files: {
|
||||
# 'bundle-stats.json': {
|
||||
# content: JSON.stringify(content, null, 2)
|
||||
# }
|
||||
# }
|
||||
# });
|
||||
# }
|
||||
|
||||
# const stats = require('/tmp/bundle-stats.json');
|
||||
# const content = await getGistContent();
|
||||
# content['${{ github.event.pull_request.base.ref }}'] = stats;
|
||||
# await updateGistContent(content);
|
||||
|
||||
# - name: Update PR Description
|
||||
# uses: actions/github-script@v6
|
||||
# with:
|
||||
# script: |
|
||||
# const { data: pr } = await github.rest.pulls.get({
|
||||
# owner: context.repo.owner,
|
||||
# repo: context.repo.repo,
|
||||
# pull_number: context.issue.number
|
||||
# });
|
||||
|
||||
# let body = pr.body || '';
|
||||
# const statsMarker = '### Bundle Size';
|
||||
# const comparison = '${{ steps.compare.outputs.stats }}';
|
||||
|
||||
# if (body.includes(statsMarker)) {
|
||||
# body = body.replace(
|
||||
# new RegExp(`${statsMarker}[^\n]*\n[^\n]*`),
|
||||
# `${statsMarker}\n${comparison}`
|
||||
# );
|
||||
# } else {
|
||||
# body += `\n\n${statsMarker}\n${comparison}`;
|
||||
# }
|
||||
|
||||
# await github.rest.pulls.update({
|
||||
# owner: context.repo.owner,
|
||||
# repo: context.repo.repo,
|
||||
# pull_number: context.issue.number,
|
||||
# body
|
||||
# });
|
||||
# dedupe-check:
|
||||
# runs-on: ubuntu-latest
|
||||
# if: github.event.pull_request.head.ref == 'next'
|
||||
# steps:
|
||||
# - name: Checkout repository
|
||||
# uses: actions/checkout@v2
|
||||
|
||||
# - name: Install pnpm
|
||||
# run: npm install -g pnpm@9.0.4
|
||||
|
||||
# - name: Run pnpm dedupe
|
||||
# run: pnpm dedupe
|
||||
|
||||
# - name: Check for changes
|
||||
# run: |
|
||||
# if ! git diff --exit-code --quiet pnpm-lock.yaml; then
|
||||
# echo "pnpm dedupe introduced changes:"
|
||||
# git diff --color=always pnpm-lock.yaml
|
||||
# exit 1
|
||||
# else
|
||||
# echo "No changes detected after pnpm dedupe in pnpm-lock.yaml"
|
||||
# fi
|
||||
path: cypress/integration/__image_snapshots__/
|
||||
|
|
|
|||
29
.github/workflows/fix-lint.yml
vendored
|
|
@ -1,29 +0,0 @@
|
|||
name: Fix Lint Command
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: >-
|
||||
github.event.issue.pull_request != '' &&
|
||||
(
|
||||
contains(github.event.comment.body, '/fix')
|
||||
)
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.issue.number }}/head
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- run: pnpm install
|
||||
- run: pnpm lint --fix
|
||||
- name: Push Changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
28
.github/workflows/merge-next.yml
vendored
|
|
@ -1,28 +0,0 @@
|
|||
name: Update Base Branch Command
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: >-
|
||||
github.event.issue.pull_request != '' &&
|
||||
(
|
||||
contains(github.event.comment.body, '/update')
|
||||
)
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history so we can merge branches
|
||||
ref: refs/pull/${{ github.event.issue.number }}/head
|
||||
- name: Fetch All Branches
|
||||
run: git fetch --all
|
||||
# - name: Checkout PR
|
||||
# run: git checkout ${{ github.event.issue.pull_request.head.ref }}
|
||||
- name: Merge From Next
|
||||
run: git merge origin/next --strategy-option=theirs
|
||||
- name: Push Changes
|
||||
run: git push
|
||||
91
.github/workflows/next-deploy.yml
vendored
|
|
@ -1,91 +0,0 @@
|
|||
name: Vercel Deploy Next
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
ALIASES: ${{ vars.ALIASES }}
|
||||
MAIN_MENU_LINKS: ${{ vars.MAIN_MENU_LINKS }}
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- next
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- name: Install Global Dependencies
|
||||
run: pnpm add -g vercel
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
- name: Pull Vercel Environment Information
|
||||
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- name: Write Release Info
|
||||
run: |
|
||||
echo "{\"latestTag\": \"$(git rev-parse --short $GITHUB_SHA)\", \"isCommit\": true}" > assets/release.json
|
||||
- name: Download Generated Sounds map
|
||||
run: node scripts/downloadSoundsMap.mjs
|
||||
- name: Build Project Artifacts
|
||||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
||||
env:
|
||||
CONFIG_JSON_SOURCE: BUNDLED
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
- name: Copy playground files
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
pnpm build-playground
|
||||
cp -r renderer/dist/* .vercel/output/static/playground/
|
||||
- name: Deploy Project Artifacts to Vercel
|
||||
uses: mathiasvr/command-output@v2.0.0
|
||||
with:
|
||||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
|
||||
id: deploy
|
||||
- name: Start servers for testing
|
||||
run: |
|
||||
nohup pnpm prod-start &
|
||||
nohup pnpm test-mc-server &
|
||||
- name: Run Cypress smoke tests
|
||||
uses: cypress-io/github-action@v5
|
||||
with:
|
||||
install: false
|
||||
spec: cypress/e2e/smoke.spec.ts
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: cypress-smoke-test-screenshots
|
||||
path: cypress/screenshots/
|
||||
- name: Set deployment aliases
|
||||
run: |
|
||||
for alias in $(echo ${{ secrets.TEST_PREVIEW_DOMAIN }} | tr "," "\n"); do
|
||||
vercel alias set ${{ steps.deploy.outputs.stdout }} $alias --token=${{ secrets.VERCEL_TOKEN }} --scope=zaro
|
||||
done
|
||||
|
||||
- name: Create Release Pull Request
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const { data: pulls } = await github.rest.pulls.list({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
head: `${context.repo.owner}:next`,
|
||||
base: 'release',
|
||||
state: 'open'
|
||||
});
|
||||
|
||||
if (pulls.length === 0) {
|
||||
await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: 'Release',
|
||||
head: 'next',
|
||||
base: 'release',
|
||||
body: 'PR was created automatically by the release workflow, hope you release it as soon as possible!',
|
||||
});
|
||||
}
|
||||
90
.github/workflows/preview.yml
vendored
|
|
@ -1,114 +1,42 @@
|
|||
name: Vercel PR Deploy (Preview)
|
||||
name: Vercel Deploy Preview
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
ALIASES: ${{ vars.ALIASES }}
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_target:
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
# todo skip already created deploys on that commit
|
||||
if: >-
|
||||
github.event.issue.pull_request != '' &&
|
||||
(
|
||||
(
|
||||
github.event_name == 'issue_comment' &&
|
||||
contains(github.event.comment.body, '/deploy') &&
|
||||
github.event.issue.pull_request != null
|
||||
) ||
|
||||
(
|
||||
github.event_name == 'pull_request_target' &&
|
||||
contains(fromJson(vars.AUTO_DEPLOY_PRS), github.event.pull_request.number)
|
||||
)
|
||||
contains(github.event.comment.body, '/deploy')
|
||||
)
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout Base To Temp
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: temp-base-repo
|
||||
- name: Get deployment alias
|
||||
run: node temp-base-repo/scripts/githubActions.mjs getAlias
|
||||
id: alias
|
||||
env:
|
||||
ALIASES: ${{ env.ALIASES }}
|
||||
PULL_URL: ${{ github.event.issue.pull_request.url || github.event.pull_request.url }}
|
||||
- name: Checkout PR (comment)
|
||||
uses: actions/checkout@v2
|
||||
if: github.event_name == 'issue_comment'
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.issue.number }}/head
|
||||
- name: Checkout PR (pull_request)
|
||||
uses: actions/checkout@v2
|
||||
if: github.event_name == 'pull_request_target'
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/head
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: "pnpm"
|
||||
- name: Update deployAlwaysUpdate packages
|
||||
run: |
|
||||
if [ -f package.json ]; then
|
||||
PACKAGES=$(node -e "const pkg = require('./package.json'); if (pkg.deployAlwaysUpdate) console.log(pkg.deployAlwaysUpdate.join(' '))")
|
||||
if [ ! -z "$PACKAGES" ]; then
|
||||
echo "Updating packages: $PACKAGES"
|
||||
pnpm up -L $PACKAGES
|
||||
else
|
||||
echo "No deployAlwaysUpdate packages found in package.json"
|
||||
fi
|
||||
else
|
||||
echo "package.json not found"
|
||||
fi
|
||||
- name: Install Global Dependencies
|
||||
run: pnpm add -g vercel
|
||||
run: npm install --global vercel pnpm
|
||||
- name: Pull Vercel Environment Information
|
||||
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- name: Write Release Info
|
||||
run: |
|
||||
echo "{\"latestTag\": \"$(git rev-parse --short ${{ github.event.pull_request.head.sha }})\", \"isCommit\": true}" > assets/release.json
|
||||
- name: Download Generated Sounds map
|
||||
run: node scripts/downloadSoundsMap.mjs
|
||||
- name: Build Project Artifacts
|
||||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
||||
env:
|
||||
CONFIG_JSON_SOURCE: BUNDLED
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
- name: Copy playground files
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
pnpm build-playground
|
||||
cp -r renderer/dist/* .vercel/output/static/playground/
|
||||
- name: Write pr redirect index.html
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/pr
|
||||
echo "<meta http-equiv='refresh' content='0;url=https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number || github.event.pull_request.number }}'>" > .vercel/output/static/pr/index.html
|
||||
- name: Write commit redirect index.html
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/commit
|
||||
echo "<meta http-equiv='refresh' content='0;url=https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number || github.event.pull_request.number }}/commits/${{ github.event.pull_request.head.sha }}'>" > .vercel/output/static/commit/index.html
|
||||
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: Deploy Project Artifacts to Vercel
|
||||
uses: mathiasvr/command-output@v2.0.0
|
||||
with:
|
||||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
|
||||
id: deploy
|
||||
- name: Set deployment alias
|
||||
run: vercel alias set ${{ steps.deploy.outputs.stdout }} ${{ secrets.TEST_PREVIEW_DOMAIN }} --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- uses: mshick/add-pr-comment@v2
|
||||
# if: github.event_name == 'issue_comment'
|
||||
with:
|
||||
allow-repeats: true
|
||||
message: |
|
||||
Deployed to Vercel Preview: ${{ steps.deploy.outputs.stdout }}
|
||||
[Playground](${{ steps.deploy.outputs.stdout }}/playground/)
|
||||
[Storybook](${{ steps.deploy.outputs.stdout }}/storybook/)
|
||||
# - run: git checkout next scripts/githubActions.mjs
|
||||
- name: Set deployment alias
|
||||
if: ${{ steps.alias.outputs.alias != '' && steps.alias.outputs.alias != 'mcraft.fun' && steps.alias.outputs.alias != 's.mcraft.fun' }}
|
||||
run: |
|
||||
for alias in $(echo ${{ steps.alias.outputs.alias }} | tr "," "\n"); do
|
||||
vercel alias set ${{ steps.deploy.outputs.stdout }} $alias --token=${{ secrets.VERCEL_TOKEN }} --scope=zaro
|
||||
done
|
||||
|
|
|
|||
38
.github/workflows/publish.yml
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
name: Deploy to GitHub pages
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@master
|
||||
- name: Install pnpm
|
||||
run: npm i -g vercel pnpm
|
||||
# - run: pnpm install
|
||||
# - run: pnpm build
|
||||
- run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||
# will install + build to .vercel/output/static
|
||||
- run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
|
||||
- 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: Deploy Project to Vercel
|
||||
uses: mathiasvr/command-output@v2.0.0
|
||||
with:
|
||||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --prod
|
||||
id: deploy
|
||||
- run: |
|
||||
pnpx zardoy-release node --footer "This release URL: ${{ steps.deploy.outputs.stdout }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: cp vercel.json .vercel/output/static/vercel.json
|
||||
- uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: .vercel/output/static
|
||||
force_orphan: true
|
||||
116
.github/workflows/release.yml
vendored
|
|
@ -1,116 +0,0 @@
|
|||
name: Release
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
MAIN_MENU_LINKS: ${{ vars.MAIN_MENU_LINKS }}
|
||||
on:
|
||||
push:
|
||||
branches: [release]
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@master
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- name: Install Global Dependencies
|
||||
run: pnpm add -g vercel
|
||||
# - run: pnpm install
|
||||
# - run: pnpm build
|
||||
- run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- run: node scripts/replaceFavicon.mjs ${{ secrets.FAVICON_MAIN }}
|
||||
# will install + build to .vercel/output/static
|
||||
- name: Get Release Info
|
||||
run: pnpx zardoy-release empty --skip-github --output-file assets/release.json
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Download Generated Sounds map
|
||||
run: node scripts/downloadSoundsMap.mjs
|
||||
- run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
|
||||
env:
|
||||
CONFIG_JSON_SOURCE: BUNDLED
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
- name: Copy playground files
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
pnpm build-playground
|
||||
cp -r renderer/dist/* .vercel/output/static/playground/
|
||||
|
||||
# publish to github
|
||||
- run: cp vercel.json .vercel/output/static/vercel.json
|
||||
- uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: .vercel/output/static
|
||||
force_orphan: true
|
||||
|
||||
# Create CNAME file for custom domain
|
||||
- name: Create CNAME file
|
||||
run: echo "github.mcraft.fun" > .vercel/output/static/CNAME
|
||||
|
||||
- name: Deploy to mwc-mcraft-pages repository
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
personal_token: ${{ secrets.MCW_MCRAFT_PAGE_DEPLOY_TOKEN }}
|
||||
external_repository: ${{ github.repository_owner }}/mwc-mcraft-pages
|
||||
publish_dir: .vercel/output/static
|
||||
publish_branch: main
|
||||
destination_dir: docs
|
||||
force_orphan: true
|
||||
|
||||
- name: Change index.html title
|
||||
run: |
|
||||
# change <title>Minecraft Web Client</title> to <title>Minecraft Web Client — Free Online Browser Version</title>
|
||||
sed -i 's/<title>Minecraft Web Client<\/title>/<title>Minecraft Web Client — Free Online Browser Version<\/title>/' .vercel/output/static/index.html
|
||||
|
||||
- name: Deploy Project to Vercel
|
||||
uses: mathiasvr/command-output@v2.0.0
|
||||
with:
|
||||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --prod
|
||||
id: deploy
|
||||
- name: Get releasing alias
|
||||
run: node scripts/githubActions.mjs getReleasingAlias
|
||||
id: alias
|
||||
- name: Set deployment alias
|
||||
run: |
|
||||
for alias in $(echo ${{ steps.alias.outputs.alias }} | tr "," "\n"); do
|
||||
vercel alias set ${{ steps.deploy.outputs.stdout }} $alias --token=${{ secrets.VERCEL_TOKEN }} --scope=zaro
|
||||
done
|
||||
|
||||
- name: Build single-file version - minecraft.html
|
||||
run: pnpm build-single-file && mv dist/single/index.html minecraft.html
|
||||
- name: Build self-host version
|
||||
run: pnpm build
|
||||
- name: Bundle server.js
|
||||
run: |
|
||||
pnpm esbuild server.js --bundle --platform=node --outfile=bundled-server.js --define:process.env.NODE_ENV="'production'"
|
||||
|
||||
- name: Create zip package
|
||||
run: |
|
||||
mkdir -p package
|
||||
cp -r dist package/
|
||||
cp bundled-server.js package/server.js
|
||||
cd package
|
||||
zip -r ../self-host.zip .
|
||||
|
||||
- run: |
|
||||
pnpx zardoy-release node --footer "This release URL: https://$(echo ${{ steps.alias.outputs.alias }} | cut -d',' -f1) (Vercel URL: ${{ steps.deploy.outputs.stdout }})"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# has possible output: tag
|
||||
id: release
|
||||
|
||||
# has output
|
||||
- name: Set publishing config
|
||||
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
# - run: pnpm tsx scripts/buildNpmReact.ts ${{ steps.release.outputs.tag }}
|
||||
# if: steps.release.outputs.tag
|
||||
# env:
|
||||
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
10
.gitignore
vendored
|
|
@ -7,18 +7,12 @@ package-lock.json
|
|||
Thumbs.db
|
||||
build
|
||||
localSettings.mjs
|
||||
dist*
|
||||
dist
|
||||
.DS_Store
|
||||
.idea/
|
||||
/world
|
||||
data*.json
|
||||
world
|
||||
out
|
||||
*.iml
|
||||
.vercel
|
||||
generated
|
||||
storybook-static
|
||||
server-jar
|
||||
config.local.json
|
||||
logs/
|
||||
|
||||
src/react/npmReactComponents.ts
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
import React from 'react'
|
||||
|
||||
import type { Preview } from "@storybook/react"
|
||||
import type { Preview } from "@storybook/react";
|
||||
|
||||
import './storybook.css'
|
||||
import '../src/styles.css'
|
||||
import '../src/scaleInterface'
|
||||
import './storybook.css'
|
||||
|
||||
const preview: Preview = {
|
||||
decorators: [
|
||||
(Story, c) => {
|
||||
const noScaling = c.parameters.noScaling
|
||||
return <div id={noScaling ? '' : 'ui-root'}>
|
||||
(Story) => (
|
||||
<div id='ui-root'>
|
||||
<Story />
|
||||
</div>
|
||||
},
|
||||
),
|
||||
],
|
||||
parameters: {
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
|
|
@ -24,6 +22,6 @@ const preview: Preview = {
|
|||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export default preview
|
||||
export default preview;
|
||||
|
|
|
|||
5
.vscode/launch.json
vendored
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"configurations": [
|
||||
// UPDATED: all configs below are misconfigured and will crash vscode, open dist/index.html and use live preview debug instead
|
||||
// recommended as much faster
|
||||
{
|
||||
// to launch "C:\Program Files\Google\Chrome Beta\Application\chrome.exe" --remote-debugging-port=9222
|
||||
|
|
@ -28,7 +29,7 @@
|
|||
"type": "chrome",
|
||||
"name": "Launch Chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:3000/",
|
||||
"url": "http://localhost:8080/",
|
||||
"pathMapping": {
|
||||
"/": "${workspaceFolder}/dist"
|
||||
},
|
||||
|
|
@ -49,7 +50,7 @@
|
|||
"name": "Attach Firefox",
|
||||
"request": "attach",
|
||||
// comment if using webpack
|
||||
"url": "http://localhost:3000/",
|
||||
"url": "http://localhost:8080/",
|
||||
"webRoot": "${workspaceFolder}/",
|
||||
"skipFiles": [
|
||||
// "<node_internals>/**/*vendors*"
|
||||
|
|
|
|||
189
CONTRIBUTING.md
|
|
@ -2,194 +2,13 @@
|
|||
|
||||
After forking the repository, run the following commands to get started:
|
||||
|
||||
0. Ensure you have [Node.js](https://nodejs.org) installed. Enable corepack with `corepack enable` *(1).
|
||||
0. Ensure you have [Node.js](https://nodejs.org) and `pnpm` installed. To install pnpm run `npm i -g pnpm`.
|
||||
1. Install dependencies: `pnpm i`
|
||||
2. Start the project in development mode: `pnpm start` or build the project for production: `pnpm build`
|
||||
3. Read the [Tasks Categories](#tasks-categories) and [Workflow](#workflow) sections below
|
||||
4. Let us know if you are working on something and be sure to open a PR if you got any changes. Happy coding!
|
||||
2. Start the project in development mode: `pnpm start`
|
||||
|
||||
*(1): If you are getting `Cannot find matching keyid` update corepack to the latest version with `npm i -g corepack`.
|
||||
A few notes:
|
||||
|
||||
*(2): If still something doesn't work ensure you have the right nodejs version with `node -v` (tested on 22.x)
|
||||
|
||||
<!-- *(3): For GitHub codespaces (cloud ide): Run `pnpm i @rsbuild/core@1.2.4 @rsbuild/plugin-node-polyfill@1.3.0 @rsbuild/plugin-react@1.1.0 @rsbuild/plugin-typed-css-modules@1.0.2` command to avoid crashes because of limited ram -->
|
||||
|
||||
## Project Structure
|
||||
|
||||
There are 3 main parts of the project:
|
||||
|
||||
### Core (`src`)
|
||||
|
||||
This is the main app source code which reuses all the other parts of the project.
|
||||
|
||||
> The first version used Webpack, then was migrated to Esbuild and now is using Rsbuild!
|
||||
|
||||
- Scripts:
|
||||
- Start: `pnpm start`, `pnpm dev-rsbuild` (if you don't need proxy server also running)
|
||||
- Build: `pnpm build` (note that `build` script builds only the core app, not the whole project!)
|
||||
|
||||
Paths:
|
||||
|
||||
- `src` - main app source code
|
||||
- `src/react` - React components - almost all UI is in this folder. Almost every component has its base (reused in app and storybook) and `Provider` - which is a component that provides context to its children. Consider looking at DeathScreen component to see how it's used.
|
||||
|
||||
### Renderer: Playground & Mesher (`renderer`)
|
||||
|
||||
- Playground Scripts:
|
||||
- Start: `pnpm run-playground` (playground, mesher + server) or `pnpm watch-playground`
|
||||
- Build: `pnpm build-playground` or `node renderer/esbuild.mjs`
|
||||
|
||||
- Mesher Scripts:
|
||||
- Start: `pnpm watch-mesher`
|
||||
- Build: `pnpm build-mesher`
|
||||
|
||||
Paths:
|
||||
|
||||
- `renderer` - Improved and refactored version of <https://github.com/PrismarineJS/prismarine-viewer>. Here is everything related to rendering the game world itself (no ui at all). Two most important parts here are:
|
||||
- `renderer/viewer/lib/worldrenderer.ts` - adding new objects to three.js happens here (sections)
|
||||
- `renderer/viewer/lib/models.ts` - preparing data for rendering (blocks) - happens in worker: out file - `worker.js`, building - `renderer/buildWorker.mjs`
|
||||
- `renderer/playground/playground.ts` - Playground (source of <mcraft.fun/playground.html>) Use this for testing any rendering changes. You can also modify the playground code.
|
||||
|
||||
### Storybook (`.storybook`)
|
||||
|
||||
Storybook is a tool for easier developing and testing React components.
|
||||
Path of all Storybook stories is `src/react/**/*.stories.tsx`.
|
||||
|
||||
- Scripts:
|
||||
- Start: `pnpm storybook`
|
||||
- Build: `pnpm build-storybook`
|
||||
|
||||
## Core-related
|
||||
|
||||
How different modules are used:
|
||||
|
||||
- `mineflayer` - provider `bot` variable and as mineflayer states it is a wrapper for the `node-minecraft-protocol` module and is used to connect and interact with real Java Minecraft servers. However not all events & properties are exposed and sometimes you have to use `bot._client.on('packet_name', data => ...)` to handle packets that are not handled via mineflayer API. Also you can use almost any mineflayer plugin.
|
||||
|
||||
## Running Main App + Playground
|
||||
|
||||
To start the main web app and playground, run `pnpm run-all`. Note is doesn't start storybook and tests.
|
||||
|
||||
## Cypress Tests (E2E)
|
||||
|
||||
Cypress tests are located in `cypress` folder. To run them, run `pnpm test-mc-server` and then `pnpm test:cypress` when the `pnpm prod-start` is running (or change the port to 3000 to test with the dev server). Usually you don't need to run these until you get issues on the CI.
|
||||
|
||||
## Unit Tests
|
||||
|
||||
There are not many unit tests for now (which we are trying to improve).
|
||||
Location of unit tests: `**/*.test.ts` files in `src` folder and `renderer` folder.
|
||||
Start them with `pnpm test-unit`.
|
||||
|
||||
## Making protocol-related changes
|
||||
|
||||
You can get a description of packets for the latest protocol version from <https://wiki.vg/Protocol> and for previous protocol versions from <https://wiki.vg/Protocol_version_numbers> (look for *Page* links that have *Protocol* in URL).
|
||||
|
||||
Also there are [src/generatedClientPackets.ts](src/generatedClientPackets.ts) and [src/generatedServerPackets.ts](src/generatedServerPackets.ts) files that have definitions of packets that come from the server and the client respectively. These files are generated from the protocol files. Protocol, blocks info and other data go from <https://github.com/prismarineJS/minecraft-data> repository.
|
||||
|
||||
## A few other notes
|
||||
|
||||
- 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)
|
||||
|
||||
- Press `Y` to reload application into the same world (server, local world or random singleplayer world)
|
||||
- To start React profiling disable `REACT_APP_PROFILING` code first.
|
||||
- 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.
|
||||
- Use `start-prod` script to start the project in production mode after running the `build` script to build the project.
|
||||
- If CI is failing on the next branch for some reason, feel free to use the latest commit for release branch. We will update the base branch asap. Please, always make sure to allow maintainers do changes when opening PRs.
|
||||
|
||||
## Tasks Categories
|
||||
|
||||
(most important for now are on top).
|
||||
|
||||
## 1. Client-side Logic (most important right now)
|
||||
|
||||
Everything related to the client side packets. Investigate issues when something goes wrong with some server. It's much easier to work on these types of tasks when you have experience in Java with Minecraft, a deep understanding of the original client, and know how to debug it (which is not hard actually). Right now the client is easily detectable by anti-cheat plugins, and the main goal is to fix it (mostly because of wrong physics implementation).
|
||||
|
||||
Priority tasks:
|
||||
|
||||
- Rewrite or fix the physics logic (Botcraft or Grim can be used as a reference as well)
|
||||
- Implement basic minecart / boat / horse riding
|
||||
- Fix auto jump module (false triggers, performance issues)
|
||||
- Investigate connection issues to some servers
|
||||
- Setup a platform for automatic cron testing against the latest version of the anti-cheat plugins
|
||||
- ...
|
||||
|
||||
Goals:
|
||||
|
||||
- Make more servers playable. Right now on hypixel-like servers (servers with minigames), only tnt run (and probably ) is fully playable.
|
||||
|
||||
Notes:
|
||||
|
||||
- You can see the incoming/outgoing packets in the console (F12 in Chrome) by enabling `options.debugLogNotFrequentPackets = true`. However, if you need a FULL log of all packets, you can start recording the packets by going into `Settings` > `Advanced` > `Enable Packets Replay` and then you can download the file and use it to replay the packets.
|
||||
- You can use mcraft-e2e studio to send the same packets over and over again (which is useful for testing) or use the packets replayer (which is useful for debugging).
|
||||
|
||||
## 2. Three.js Renderer
|
||||
|
||||
Example tasks:
|
||||
|
||||
- Improve / fix entity rendering
|
||||
- Better update entities on specific packets
|
||||
- Investigate performance issues under different conditions (instructions provided)
|
||||
- Work on the playground code
|
||||
|
||||
Goals:
|
||||
|
||||
- Fix a lot of entity rendering issues (including position updates)
|
||||
- Implement switching camera mode (first person, third person, etc)
|
||||
- Animated blocks
|
||||
- Armor rendering
|
||||
- ...
|
||||
|
||||
Note:
|
||||
|
||||
- It's useful to know how to use helpers & additional cameras (e.g. setScissor)
|
||||
|
||||
## 3. Server-side Logic
|
||||
|
||||
Flying squid fork (space-squid).
|
||||
Example tasks:
|
||||
|
||||
- Add missing commands (e.g. /scoreboard)
|
||||
- Basic physics (player fall damage, falling blocks & entities)
|
||||
- Basic entities AI (spawning, attacking)
|
||||
- Pvp
|
||||
- Emit more packets on some specific events (e.g. when a player uses an item)
|
||||
- Make more maps playable (e.g. fix when something is not implemented in both server and client and blocking map interaction)
|
||||
- ...
|
||||
|
||||
Long Term Goals:
|
||||
|
||||
- Make most adventure maps playable
|
||||
- Make a way to complete the game from the scratch (crafting, different dimensions, terrain generation, etc)
|
||||
- Make bedwars playable!
|
||||
Most of the tasks are straightforward to implement, just be sure to use a debugger ;). If you feel you are stuck, ask for help on Discord. Absolutely any tests / refactor suggestions are welcome!
|
||||
|
||||
## 4. Frontend
|
||||
|
||||
New React components, improve UI (including mobile support).
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Locate the problem on the public test server & make an easily reproducible environment (you can also use local packets replay server or your custom server setup). Dm me for details on public test server / replay server
|
||||
2. Debug the code, find an issue in the code, isolate the problem
|
||||
3. Develop, try to fix and test. Finally we should find a way to fix it. It's ideal to have an automatic test but it's not necessary for now
|
||||
3. Repeat step 1 to make sure the task is done and the problem is fixed (or the feature is implemented)
|
||||
|
||||
## Updating Dependencies
|
||||
|
||||
1. Use `pnpm update-git-deps` to check and update git dependencies (like mineflayer fork, prismarine packages etc). The script will:
|
||||
- Show which git dependencies have updates available
|
||||
- Ask if you want to update them
|
||||
- Skip dependencies listed in `pnpm.updateConfig.ignoreDependencies`
|
||||
|
||||
2. Update PrismarineJS dependencies to the latest version: `minecraft-data` (be sure to replace the version twice in the package.json), `mineflayer`, `minecraft-protocol`, `prismarine-block`, `prismarine-chunk`, `prismarine-item`, ...
|
||||
|
||||
3. If `minecraft-protocol` patch fails, do this:
|
||||
1. Remove the patch from `patchedDependencies` in `package.json`
|
||||
2. Run `pnpm patch minecraft-protocol`, open patch directory
|
||||
3. Apply the patch manually in this directory: `patch -p1 < minecraft-protocol@<version>.patch`
|
||||
4. Run the suggested command from `pnpm patch ...` (previous step) to update the patch
|
||||
|
||||
### Would be useful to have
|
||||
|
||||
- cleanup folder & modules structure, cleanup playground code
|
||||
- Use `start-prod` script to start the project in production mode after running `build` script to build the project.
|
||||
|
|
|
|||
44
Dockerfile
|
|
@ -1,43 +1,9 @@
|
|||
# ---- Build Stage ----
|
||||
FROM node:18-alpine AS build
|
||||
FROM node:14-alpine
|
||||
# Without git installing the npm packages fails
|
||||
RUN apk add git
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
# install pnpm with corepack
|
||||
RUN corepack enable
|
||||
# Build arguments
|
||||
ARG DOWNLOAD_SOUNDS=false
|
||||
ARG DISABLE_SERVICE_WORKER=false
|
||||
ARG CONFIG_JSON_SOURCE=REMOTE
|
||||
# TODO need flat --no-root-optional
|
||||
RUN node ./scripts/dockerPrepare.mjs
|
||||
RUN pnpm i
|
||||
# Download sounds if flag is enabled
|
||||
RUN if [ "$DOWNLOAD_SOUNDS" = "true" ] ; then node scripts/downloadSoundsMap.mjs ; fi
|
||||
|
||||
# TODO for development
|
||||
# EXPOSE 9090
|
||||
# VOLUME /app/src
|
||||
# VOLUME /app/renderer
|
||||
# ENTRYPOINT ["pnpm", "run", "run-all"]
|
||||
|
||||
# only for prod
|
||||
RUN DISABLE_SERVICE_WORKER=$DISABLE_SERVICE_WORKER \
|
||||
CONFIG_JSON_SOURCE=$CONFIG_JSON_SOURCE \
|
||||
pnpm run build
|
||||
|
||||
# ---- Run Stage ----
|
||||
FROM node:18-alpine
|
||||
RUN apk add git
|
||||
WORKDIR /app
|
||||
# Copy build artifacts from the build stage
|
||||
COPY --from=build /app/dist /app/dist
|
||||
COPY server.js /app/server.js
|
||||
# Install express
|
||||
RUN npm i -g pnpm@10.8.0
|
||||
RUN npm init -yp
|
||||
RUN pnpm i express github:zardoy/prismarinejs-net-browserify compression cors
|
||||
EXPOSE 8080
|
||||
VOLUME /app/public
|
||||
ENTRYPOINT ["node", "server.js", "--prod"]
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
ENTRYPOINT ["npm", "run", "prod-start"]
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
# ---- Run Stage ----
|
||||
FROM node:18-alpine
|
||||
RUN apk add git
|
||||
WORKDIR /app
|
||||
COPY server.js /app/server.js
|
||||
# Install server dependencies
|
||||
RUN npm i -g pnpm@9.0.4
|
||||
RUN npm init -yp
|
||||
RUN pnpm i express github:zardoy/prismarinejs-net-browserify compression cors
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["node", "server.js"]
|
||||
206
README.MD
|
|
@ -1,66 +1,21 @@
|
|||
# Minecraft Web Client
|
||||
|
||||

|
||||
A true Minecraft client running in your browser! A port of the original game to the web, written in JavaScript using modern web technologies.
|
||||
|
||||
Minecraft **clone** rewritten in TypeScript using the best modern web technologies. Minecraft vanilla-compatible client and integrated server packaged into a single web app.
|
||||
|
||||
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 default (`develop`) branch is deployed to [s.mcraft.fun](https://s.mcraft.fun/) and [s.pcm.gg](https://s.pcm.gg/) - so it's usually newer, but might be less stable.
|
||||
|
||||
> For Turkey/Russia use [ru.mcraft.fun](https://ru.mcraft.fun/) (since Cloudflare is blocked)
|
||||
|
||||
Don't confuse with [Eaglercraft](https://git.eaglercraft.rip/eaglercraft/eaglercraft-1.8) which is a REAL vanilla Minecraft Java edition port to the web (but with its own limitations). Eaglercraft is a fully playable solution, meanwhile this project is aimed for *device-compatiiblity* and better performance so it feels portable, flexible and lightweight. It's also a very strong example on how to build true HTML games for the web at scale entirely with the JS ecosystem. Have fun!
|
||||
|
||||
For building the project yourself / contributing, see [Development, Debugging & Contributing](#development-debugging--contributing). For reference at what and how web technologies / frameworks are used, see [TECH.md](./TECH.md) (also for comparison with Eaglercraft).
|
||||
|
||||
> **Note**: You can deploy it on your own server in less than a minute using a one-liner script from [Minecraft Everywhere repo](https://github.com/zardoy/minecraft-everywhere)
|
||||
This project is a work in progress, but I consider it to be usable. If you encounter any bugs or usability issues, please report them!
|
||||
|
||||
### Big Features
|
||||
|
||||
- Official Mineflayer [plugin integration](https://github.com/zardoy/mcraft-fun-mineflayer-plugin)! View / Control your bot remotely.
|
||||
- Connect to any offline server* (it's possible because of proxy servers, see below)
|
||||
- Open any zip world file or even folder in read-write mode!
|
||||
- Connect to Java servers running in both offline (cracked) and online mode* (it's possible because of proxy servers, see below)
|
||||
- Integrated JS server clone capable of opening Java world saves in any way (folders, zip, web chunks streaming, etc)
|
||||
- Singleplayer mode with simple world generations!
|
||||
- Singleplayer mode with simple world generation
|
||||
- Works offline
|
||||
- Play with friends over global network! (P2P is powered by Peer.js servers)
|
||||
- First-class touch (mobile) & controller support
|
||||
- First-class keybindings configuration
|
||||
- Advanced Resource pack support: Custom GUI, all textures. Server resource packs are supported with proper CORS configuration.
|
||||
- Builtin JEI with recipes & descriptions for almost every item (JEI is creative inventory replacement)
|
||||
- Custom protocol channel extensions (eg for custom block models in the world)
|
||||
- Play with friends over internet! (P2P is powered by Peer.js discovery servers)
|
||||
- ~~Google Drive support for reading / saving worlds back to the cloud~~
|
||||
- Support for custom rendering 3D engines. Modular architecture.
|
||||
- Resource pack support
|
||||
- even even more!
|
||||
|
||||
All components that are in [Storybook](https://minimap.mcraft.fun/storybook/) are published as npm module and can be used in other projects: [`minecraft-react`](https://npmjs.com/minecraft-react)
|
||||
|
||||
### Recommended Settings
|
||||
|
||||
- Controls -> **Touch Controls Type** -> **Joystick**
|
||||
- Controls -> **Auto Full Screen** -> **On** - To avoid ctrl+w issue
|
||||
- Interface -> **Enable Minimap** -> **Always** - To enable useful minimap (why not?)
|
||||
- Controls -> **Raw Input** -> **On** - This will make the controls more precise (UPD: already enabled by default)
|
||||
- Interface -> **Chat Select** -> **On** - To select chat messages (UPD: already enabled by default)
|
||||
|
||||
### Browser Notes
|
||||
|
||||
This project is tested with BrowserStack. Special thanks to [BrowserStack](https://www.browserstack.com/) for providing testing infrastructure!
|
||||
|
||||
Howerver, it's known that these browsers have issues:
|
||||
|
||||
**Opera Mini**: Disable *mouse gestures* in browsre settings to avoid opening new tab on right click hold
|
||||
|
||||
**Vivaldi**: Disable Controls -> *Raw Input* in game settings if experiencing issues
|
||||
|
||||
### Versions Support
|
||||
|
||||
Server versions 1.8 - 1.21.5 are supported.
|
||||
First class versions (most of the features are tested on these versions):
|
||||
|
||||
- 1.19.4
|
||||
- 1.21.4
|
||||
|
||||
Versions below 1.13 are not tested currently and may not work correctly.
|
||||
There are a lot
|
||||
|
||||
### World Loading
|
||||
|
||||
|
|
@ -68,48 +23,18 @@ Zip files and folders are supported. Just drag and drop them into the browser wi
|
|||
In case of opening zip files they are stored in your ram entirely, so there is a ~300mb file limit on IOS.
|
||||
Whatever offline mode you used (zip, folder, just single player), you can always export world with the `/export` command typed in the game chat.
|
||||
|
||||

|
||||
### Servers
|
||||
|
||||
### Servers & Proxy
|
||||
|
||||
You can play almost on any Java server, vanilla servers are fully supported.
|
||||
You can play almost on any server, supporting offline connections.
|
||||
See the [Mineflayer](https://github.com/PrismarineJS/mineflayer) repo for the list of supported versions (should support majority of versions).
|
||||
There is a builtin proxy, but you can also host your one! Just clone the repo, run `pnpm i` (following CONTRIBUTING.MD) and run `pnpm prod-start`, then you can specify `http://localhost:8080` in the proxy field. Or you can deploy it to the cloud service:
|
||||
There is a builtin proxy, but you can also host a your one! Just clone the repo, run `pnpm i` (following CONTRIBUTING.MD) and run `pnpm prod-start`, then you can specify `http://localhost:8080` in the proxy field.
|
||||
MS account authentication will be supported soon.
|
||||
|
||||
[](https://app.koyeb.com/deploy?name=minecraft-web-client&type=git&repository=zardoy%2Fminecraft-web-client&branch=next&builder=dockerfile&env%5B%5D=&ports=8080%3Bhttp%3B%2F)
|
||||
<!-- TODO proxy server communication graph -->
|
||||
|
||||
> **Note**: If you want to make **your own** Minecraft server accessible to web clients (without our proxies), you can use [mwc-proxy](https://github.com/zardoy/mwc-proxy) - a lightweight JS WebSocket proxy that runs on the same server as your Minecraft server, allowing players to connect directly via `wss://play.example.com`. `?client_mcraft` is added to the URL, so the proxy will know that it's this client.
|
||||
### Things that are not planned yet
|
||||
|
||||
Proxy servers are used to connect to Minecraft servers which use TCP protocol. When you connect connect to a server with a proxy, websocket connection is created between you (browser client) and the proxy server located in Europe, then the proxy connects to the Minecraft server and sends the data to the client (you) without any packet deserialization to avoid any additional delays. That said all the Minecraft protocol packets are processed by the client, right in your browser.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
A[Web App - Client] --> C[Proxy Server]
|
||||
C --> B[Minecraft Server]
|
||||
style A fill:#f9d,stroke:#333,stroke-width:2px
|
||||
style B fill:#fc0,stroke:#333,stroke-width:2px
|
||||
style C fill:#fff,stroke:#333,stroke-width:2px
|
||||
```
|
||||
|
||||
So if the server is located in Europe and you are connecting from Europe, you will have ~40ms ping (~180ms with residential proxy version), however if you are in the US and connecting to the server located in US, you will have >200ms ping, which is the worst case scenario.
|
||||
|
||||
Again, the proxy server is not a part of the client, it is a separate service that you can host yourself.
|
||||
|
||||
### Docker Files
|
||||
|
||||
- [Main Dockerfile](./Dockerfile) - for production build & offline/private usage. Includes full web-app + proxy server for connecting to Minecraft servers.
|
||||
- [Proxy Dockerfile](./Dockerfile.proxy) - for proxy server only - that one you would be able to specify in the proxy field on the client (`docker build . -f Dockerfile.proxy -t minecraft-web-proxy`)
|
||||
|
||||
In case of using docker, you don't have to follow preparation steps from CONTRIBUTING.MD, like installing Node.js, pnpm, etc.
|
||||
|
||||
### Rendering
|
||||
|
||||
#### Three.js Renderer
|
||||
|
||||
- Uses WebGL2. Chunks are rendered using Geometry Buffers prepared by 4 mesher workers.
|
||||
- Entities & text rendering
|
||||
- Supports resource packs
|
||||
- Doesn't support occlusion culling
|
||||
- Mods, plugins (basically JARs) support, shaders - since they all are related to specific game pipelines
|
||||
|
||||
### Advanced Settings
|
||||
|
||||
|
|
@ -117,122 +42,45 @@ There are many many settings, that are not exposed in the UI yet. You can find o
|
|||
|
||||
### Console
|
||||
|
||||
To open the console, press `F12`, or if you are on mobile, you can type `#dev` in the URL (browser address bar), it wont't reload the page, but you will see a button to open the console. This way you can change advanced settings and see all errors or warnings. Also this way you can access global variables (described below).
|
||||
To open the console, press `F12`, or if you are on mobile, you can type `#debug` in the URL (browser address bar), it wont't reload the page, but you will see a button to open the console. This way you can change advanced settings and see all errors or warnings. Also this way you can access global variables (described below).
|
||||
|
||||
### Development, Debugging & Contributing
|
||||
### Debugging
|
||||
|
||||
It should be easy to build/start the project locally. See [CONTRIBUTING.MD](./CONTRIBUTING.md) for more info. Also you can look at Dockerfile for reference.
|
||||
It should be easy to build/start the project locally. See [CONTRIBUTING.MD](./CONTRIBUTING.md) for more info.
|
||||
|
||||
There is world renderer playground ([link](https://mcon.vercel.app/playground/)).
|
||||
There is storybook for fast UI development. Run `pnpm storybook` to start it.
|
||||
There is world renderer playground ([link](https://mcon.vercel.app/playground.html)).
|
||||
|
||||
However, there are many things that can be done in online production version (like debugging actual source code). Also you can access some global variables in the console and there are a few useful examples:
|
||||
However, there are many things that can be done in online version. You can access some global variables in the console and useful examples:
|
||||
|
||||
- If you type `debugToggle`, press enter in console - It will enables all debug messages! Warning: this will start all packets spam.
|
||||
- `localStorage.debug = '*'` - Enables all debug messages! Warning: this will start all packets spam.
|
||||
Instead I recommend setting `options.debugLogNotFrequentPackets`. Also you can use `debugTopPackets` (with JSON.stringify) to see what packets were received/sent by name
|
||||
|
||||
- `bot` - Mineflayer bot instance. See Mineflayer documentation for more.
|
||||
- `world` - Three.js world instance, basically does all the rendering (part of renderer backend).
|
||||
- `world.sectionObjects` - Object with all active chunk sections (geometries) in the world. Each chunk section is a Three.js mesh or group.
|
||||
- `viewer` - Three.js viewer instance, basically does all the rendering.
|
||||
- `viewer.world.sectionObjects` - Object with all active chunk sections (geometries) in the world. Each chunk section is a Three.js mesh or group.
|
||||
- `debugSceneChunks` - The same as above, but relative to current bot position (e.g. 0,0 is the current chunk).
|
||||
- `debugChangedOptions` - See what options are changed. Don't change options here.
|
||||
- `localServer`/`server` - Only for singleplayer mode/host. Flying Squid server instance, see it's documentation for more.
|
||||
- `localServer` - Only for singleplayer mode/host. Flying Squid server instance, see it's documentation for more.
|
||||
- `localServer.overworld.storageProvider.regions` - See ALL LOADED region files with all raw data.
|
||||
- `localServer.levelData.LevelName = 'test'; localServer.writeLevelDat()` - Change name of the world
|
||||
|
||||
- `nbt.simplify(someNbt)` - Simplifies nbt data, so it's easier to read.
|
||||
|
||||
The most useful thing in devtools is the watch expression. You can add any expression there and it will be re-evaluated in real time. For example, you can add `world.getCameraPosition()` to see the camera position and so on.
|
||||
|
||||
<img src="./docs-assets/watch-expr.png" alt="Watch expression" width="480"/>
|
||||
|
||||
You can also drag and drop any .dat or .mca (region files) into the browser window to see it's contents in the console.
|
||||
You can also drag and drop any .dat file into the browser window to see it's contents in the console.
|
||||
|
||||
### F3 Keybindings
|
||||
|
||||
- `F3` - Toggle debug overlay
|
||||
- `F3 + A` - Reload all chunks (these that are loaded from the server)
|
||||
<!-- <!-- - `F3 + N` - Restart local server (basically resets the world!) -->
|
||||
- `F3 + G` - Toggle chunk sections (geometries) border visibility + entities outline (aka Three.js geometry helpers)
|
||||
|
||||
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.
|
||||
|
||||
There are some parameters you can set in the url to archive some specific behaviors:
|
||||
|
||||
General:
|
||||
|
||||
- **`?setting=<setting_name>:<setting_value>`** - Set and lock the setting on load. You can set multiple settings by separating them with `&` e.g. `?setting=autoParkour:true&setting=renderDistance:4`
|
||||
- `?modal=<modal>` - Open specific modal on page load eg `keybindings`. Very useful on UI changes testing during dev. For path use `,` as separator. To get currently opened modal type this in the console: `activeModalStack.at(-1).reactType`
|
||||
- `?replayFileUrl=<url>` - Load and start a packet replay session from a URL with a integrated server. For debugging / previewing recorded sessions. The file must be CORS enabled.
|
||||
|
||||
Server specific:
|
||||
|
||||
- `?ip=<server_address>` - Display connect screen to the server on load with predefined server ip. `:<port>` is optional and can be added to the ip.
|
||||
- `?name=<name>` - Set the server name for saving to the server list
|
||||
- `?version=<version>` - Set the version for the server
|
||||
- `?proxy=<proxy_address>` - Set the proxy server address to use for the server
|
||||
- `?username=<username>` - Set the username for the server
|
||||
- `?lockConnect=true` - Only works then `ip` parameter is set. Disables cancel/save buttons and all inputs in the connect screen already set as parameters. Useful for integrates iframes.
|
||||
- `?autoConnect=true` - Only works then `ip` and `version` parameters are set and `allowAutoConnect` is `true` in config.json! Directly connects to the specified server. Useful for integrates iframes.
|
||||
- `?serversList=<list_or_url>` - `<list_or_url>` can be a list of servers in the format `ip:version,ip` or a url to a json file with the same format (array) or a txt file with line-delimited list of server IPs.
|
||||
- `?addPing=<ping>` - Add a latency to both sides of the connection. Useful for testing ping issues. For example `?addPing=100` will add 200ms to your ping.
|
||||
|
||||
Single player specific:
|
||||
|
||||
- `?loadSave=<save_name>` - Load the save on load with the specified folder name (not title)
|
||||
- `?singleplayer=1` or `?sp=1` - Create empty world on load. Nothing will be saved
|
||||
- `?version=<version>` - Set the version for the singleplayer world (when used with `?singleplayer=1`)
|
||||
- `?noSave=true` - Disable auto save on unload / disconnect / export whenever a world is loaded. Only manual save with `/save` command will work.
|
||||
- `?serverSetting=<key>:<value>` - Set local server [options](https://github.com/zardoy/space-squid/tree/everything/src/modules.ts#L51). For example `?serverSetting=noInitialChunksSend:true` will disable initial chunks loading on the loading screen.
|
||||
- `?map=<map_url>` - Load the map from ZIP. You can use any url, but it must be **CORS enabled**.
|
||||
- `?mapDir=<index_file_url>` - Load the map from a file descriptor. It's recommended and the fastest way to load world but requires additional setup. The file must be in the following format:
|
||||
|
||||
```json
|
||||
{
|
||||
"baseUrl": "<url>",
|
||||
"index": {
|
||||
"level.dat": null,
|
||||
"region": {
|
||||
"r.-1.-1.mca": null,
|
||||
"r.-1.0.mca": null,
|
||||
"r.0.-1.mca": null,
|
||||
"r.0.0.mca": null,
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that `mapDir` also accepts base64 encoded JSON like so:
|
||||
`?mapDir=data:application/json;base64,...` where `...` is the base64 encoded JSON of the index file.
|
||||
In this case you must use `?mapDirBaseUrl` to specify the base URL to fetch the files from index.
|
||||
|
||||
- `?mapDirBaseUrl` - See above.
|
||||
|
||||
Only during development:
|
||||
|
||||
- `?reconnect=true` - Reconnect to the server on page reloads. Very useful on server testing.
|
||||
|
||||
<!-- - `?mapDirGuess=<base_url>` - Load the map from the provided URL and paths will be guessed with a few additional fetch requests. -->
|
||||
- `F3 + G` - Toggle chunk sections (geometries) border visibility (aka Three.js geometry helpers)
|
||||
|
||||
### 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
|
||||
- [Forked Flying Squid (Space Squid)](https://github.com/zardoy/space-squid) - The builtin offline server that makes single player & P2P possible!
|
||||
- [Flying Squid](https://github.com/prismarineJS/flying-squid) - The builtin server that makes single player possible! Here forked version is used.
|
||||
- [Prismarine Provider Anvil](https://github.com/PrismarineJS/prismarine-provider-anvil) - Handles world loading (region format)
|
||||
- [Prismarine Physics](https://github.com/PrismarineJS/prismarine-physics) - Does all the physics calculations
|
||||
- [Minecraft Protocol](https://github.com/PrismarineJS/node-minecraft-protocol) - Makes connections to servers possible
|
||||
- [Peer.js](https://peerjs.com/) - P2P networking (when you open to wan)
|
||||
- [Three.js](https://threejs.org/) - Helping in 3D rendering
|
||||
|
||||
### Things that are not planned yet
|
||||
|
||||
- Mods, plugins (basically JARs) support, shaders - since they all are related to specific game pipelines
|
||||
|
||||
### Alternatives
|
||||
|
||||
- [https://github.com/ClassiCube/ClassiCube](ClassiCube - Better C# Rewrite) [DEMO](https://www.classicube.net/server/play/?warned=true)
|
||||
- [https://m.eaglercraft.com/](EaglerCraft) - Eaglercraft runnable on mobile (real Minecraft in the browser)
|
||||
- [js-minecraft](https://github.com/LabyStudio/js-minecraft) - An insanely well done clone from the graphical side that inspired many features here
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
# Minecraft React
|
||||
|
||||
Minecraft UI components for React extracted from [mcraft.fun](https://mcraft.fun) project.
|
||||
|
||||
```bash
|
||||
pnpm i minecraft-react
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
import { Scoreboard } from 'minecraft-react'
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
<Scoreboard
|
||||
open
|
||||
title="Scoreboard"
|
||||
items={[
|
||||
{ name: 'Player 1', value: 10 },
|
||||
{ name: 'Player 2', value: 20 },
|
||||
{ name: 'Player 3', value: 30 },
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
See [Storybook](https://mcraft.fun/storybook/) or [Storybook (Mirror link)](https://mcon.vercel.app/storybook/) for more examples and full components list. Also take a look at the full [standalone example](https://github.com/zardoy/minecraft-web-client/tree/experiments/UiStandaloneExample.tsx).
|
||||
|
||||
There are two types of components:
|
||||
|
||||
- Small UI components or HUD components
|
||||
- Full screen components (like sign editor, worlds selector)
|
||||
58
TECH.md
|
|
@ -1,58 +0,0 @@
|
|||
### Eaglercraft Comparison
|
||||
|
||||
This project uses proxies so you can connect to almost any vanilla server. Though proxies have some limitations such as increased latency and servers will complain about using VPN (though we have a workaround for that, but ping will be much higher).
|
||||
This client generally has better performance but some features reproduction might be inaccurate eg its less stable and more buggy in some cases.
|
||||
|
||||
| Feature | This project | Eaglercraft | Description |
|
||||
| --------------------------------- | ----------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| General | | | |
|
||||
| Mobile Support (touch) | ✅(+) | ✅ | |
|
||||
| Gamepad Support | ✅ | ❌ | |
|
||||
| A11Y | ✅ | ❌ | We have DOM for almost all UI so your extensions and other browser features will work natively like on any other web page (but maybe it's not needed) |
|
||||
| Game Features | | | |
|
||||
| Servers Support (quality) | ❌(+) | ✅ | Eaglercraft is vanilla Minecraft, while this project tries to emulate original game behavior at protocol level (Mineflayer is used) |
|
||||
| Servers Support (any version, ip) | ✅ | ❌ | We support almost all Minecraft versions, only important if you connect to a server where you need new content like blocks or if you play with friends. And you can connect to almost any server using proxy servers! |
|
||||
| Servers Support (online mode) | ✅ | ❌ | Join to online servers like Hypixel using your Microsoft account without additional proxies |
|
||||
| Singleplayer Survival Features | ❌ | ✅ | Just like Eaglercraft this project can generate and save worlds, but generator is simple and only a few survival features are supported (look here for [supported features list](https://github.com/zardoy/space-squid)) |
|
||||
| Singleplayer Maps | ✅ | ✅ | We support any version, but adventure maps won't work, but simple parkour and build maps might be interesting to explore... |
|
||||
| Singleplayer Maps World Streaming | ✅ | ❌ | Thanks to Browserfs, saves can be loaded to local singleplayer server using multiple ways: from local folder, server directory (not zip), dropbox or other cloud *backend* etc... |
|
||||
| P2P Multiplayer | ✅ | ✅ | A way to connect to other browser running the project. But it's almost useless here since many survival features are not implemented. Maybe only to build / explore maps together... |
|
||||
| Voice Chat | ❌(+) | ✅ | Eaglercraft has custom WebRTC voice chat implementation, though it could also be easily implemented there |
|
||||
| Online Servers | ✅ | ❌ | We have custom implementation (including integration on proxy side) for joining to servers |
|
||||
| Plugin Features | ✅ | ❌ | We have Mineflayer plugins support, like Auto Jump & Auto Parkour was added here that way |
|
||||
| Direct Connection | ✅ | ✅ | We have DOM for almost all UI so your extensions and other browser features will work natively like on any other web page |
|
||||
| Moding | ✅(own js mods) | ❌ | This project will support mods for singleplayer. In theory its possible to implement support for modded servers on protocol level (including all needed mods) |
|
||||
| Video Recording | ❌ | ✅ | Doesn't feel needed |
|
||||
| Metaverse Features | ✅(50%) | ❌ | We have videos / images support inside world, but not iframes (custom protocol channel) |
|
||||
| Sounds | ✅ | ✅ | |
|
||||
| Resource Packs | ✅(+extras) | ✅ | This project has very limited support for them (only textures images are loadable for now) |
|
||||
| Assets Compressing & Splitting | ✅ | ❌ | We have advanced Minecraft data processing and good code chunk splitting so the web app will open much faster and use less memory |
|
||||
| Graphics | | | |
|
||||
| Fancy Graphics | ❌ | ✅ | While Eaglercraft has top-level shaders we don't even support lighting |
|
||||
| Fast & Efficient Graphics | ❌(+) | ❌ | Feels like no one needs to have 64 rendering distance work smoothly |
|
||||
| VR | ✅(-) | ❌ | Feels like not needed feature. UI is missing in this project since DOM can't be rendered in VR so Eaglercraft could be better in that aspect |
|
||||
| AR | ❌ | ❌ | Would be the most useless feature |
|
||||
| Minimap & Waypoints | ✅(-) | ❌ | We have buggy minimap, which can be enabled in settings and full map is opened by pressing `M` key |
|
||||
|
||||
Features available to only this project:
|
||||
|
||||
- CSS & JS Customization
|
||||
- JS Real Time Debugging & Console Scripting (eg Devtools)
|
||||
|
||||
### Tech Stack
|
||||
|
||||
Bundler: Rsbuild!
|
||||
UI: powered by React and css modules. Storybook helps with UI development.
|
||||
|
||||
### Rare WEB Features
|
||||
|
||||
There are a number of web features that are not commonly used but you might be interested in them if you decide to build your own game in the web.
|
||||
|
||||
TODO
|
||||
|
||||
| API | Usage & Description |
|
||||
| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Crypto` API | Used to make chat features work when joining online servers with authentication. |
|
||||
| `requestPointerLock({ unadjustedMovement: true })` API | Required for games. Disables system mouse acceleration (important for Mac users). Aka mouse raw input |
|
||||
| `navigator.keyboard.lock()` | (only in Chromium browsers) When entering fullscreen it allows to use any key combination like ctrl+w in the game |
|
||||
| `navigator.keyboard.getLayoutMap()` | (only in Chromium browsers) To display the right keyboard symbol for the key keybinding on different keyboard layouts (e.g. QWERTY vs AZERTY) |
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Configure client</title>
|
||||
<script>
|
||||
function removeSettings() {
|
||||
if (confirm('Are you sure you want to RESET ALL SETTINGS?')) {
|
||||
localStorage.setItem('options', '{}');
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function removeAllData() {
|
||||
localStorage.removeItem('serversList')
|
||||
localStorage.removeItem('serversHistory')
|
||||
localStorage.removeItem('authenticatedAccounts')
|
||||
localStorage.removeItem('modsAutoUpdateLastCheck')
|
||||
localStorage.removeItem('firstModsPageVisit')
|
||||
localStorage.removeItem('proxiesData')
|
||||
localStorage.removeItem('keybindings')
|
||||
localStorage.removeItem('username')
|
||||
localStorage.removeItem('customCommands')
|
||||
localStorage.removeItem('options')
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="display: flex;gap: 10px;">
|
||||
<button onclick="removeSettings()">Reset all settings</button>
|
||||
<button onclick="removeAllData()">Remove all user data (but not mods or worlds)</button>
|
||||
<!-- <button>Remove all user data (worlds, resourcepacks)</button> -->
|
||||
<!-- <button>Remove all mods</button> -->
|
||||
<!-- <button>Remove all mod repositories</button> -->
|
||||
</div>
|
||||
<input />
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
here you can place custom textures for bundled files (blocks/items) e.g. blocks/stone.png
|
||||
get file names from here (blocks/items) https://zardoy.github.io/mc-assets/
|
||||
|
|
@ -1,237 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Web Input Debugger</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
.key-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 60px);
|
||||
gap: 5px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.key {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border: 2px solid #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
background: white;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
}
|
||||
.key.pressed {
|
||||
background: #90EE90;
|
||||
}
|
||||
.key .duration {
|
||||
position: absolute;
|
||||
bottom: 2px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.key .count {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.controls {
|
||||
margin: 20px 0;
|
||||
padding: 10px;
|
||||
background: white;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.wasd-container {
|
||||
position: relative;
|
||||
width: 190px;
|
||||
height: 130px;
|
||||
}
|
||||
#KeyW {
|
||||
position: absolute;
|
||||
left: 65px;
|
||||
top: 0;
|
||||
}
|
||||
#KeyA {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 65px;
|
||||
}
|
||||
#KeyS {
|
||||
position: absolute;
|
||||
left: 65px;
|
||||
top: 65px;
|
||||
}
|
||||
#KeyD {
|
||||
position: absolute;
|
||||
left: 130px;
|
||||
top: 65px;
|
||||
}
|
||||
.space-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
#Space {
|
||||
width: 190px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="controls">
|
||||
<label>
|
||||
<input type="checkbox" id="repeatMode"> Use keydown repeat mode (auto key-up after 150ms of no repeat)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="wasd-container">
|
||||
<div id="KeyW" class="key" data-code="KeyW">W</div>
|
||||
<div id="KeyA" class="key" data-code="KeyA">A</div>
|
||||
<div id="KeyS" class="key" data-code="KeyS">S</div>
|
||||
<div id="KeyD" class="key" data-code="KeyD">D</div>
|
||||
</div>
|
||||
|
||||
<div class="key-container">
|
||||
<div id="ControlLeft" class="key" data-code="ControlLeft">Ctrl</div>
|
||||
</div>
|
||||
|
||||
<div class="space-container">
|
||||
<div id="Space" class="key" data-code="Space">Space</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const keys = {};
|
||||
const keyStats = {};
|
||||
const pressStartTimes = {};
|
||||
const keyTimeouts = {};
|
||||
|
||||
function initKeyStats(code) {
|
||||
if (!keyStats[code]) {
|
||||
keyStats[code] = {
|
||||
pressCount: 0,
|
||||
duration: 0,
|
||||
startTime: 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function updateKeyVisuals(code) {
|
||||
const element = document.getElementById(code);
|
||||
if (!element) return;
|
||||
|
||||
const stats = keyStats[code];
|
||||
if (keys[code]) {
|
||||
element.classList.add('pressed');
|
||||
const currentDuration = ((Date.now() - stats.startTime) / 1000).toFixed(1);
|
||||
element.innerHTML = `${element.getAttribute('data-code').replace('Key', '').replace('Left', '')}<span class="duration">${currentDuration}s</span><span class="count">${stats.pressCount}</span>`;
|
||||
} else {
|
||||
element.classList.remove('pressed');
|
||||
element.innerHTML = `${element.getAttribute('data-code').replace('Key', '').replace('Left', '')}<span class="count">${stats.pressCount}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
function releaseKey(code) {
|
||||
keys[code] = false;
|
||||
if (pressStartTimes[code]) {
|
||||
keyStats[code].duration += (Date.now() - pressStartTimes[code]) / 1000;
|
||||
delete pressStartTimes[code];
|
||||
}
|
||||
updateKeyVisuals(code);
|
||||
}
|
||||
|
||||
function handleKeyDown(event) {
|
||||
const code = event.code;
|
||||
const isRepeatMode = document.getElementById('repeatMode').checked;
|
||||
|
||||
initKeyStats(code);
|
||||
|
||||
// Clear any existing timeout for this key
|
||||
if (keyTimeouts[code]) {
|
||||
clearTimeout(keyTimeouts[code]);
|
||||
delete keyTimeouts[code];
|
||||
}
|
||||
|
||||
if (isRepeatMode) {
|
||||
// In repeat mode, always handle the keydown
|
||||
if (!keys[code] || event.repeat) {
|
||||
keys[code] = true;
|
||||
if (!event.repeat) {
|
||||
// Only increment count on initial press, not repeats
|
||||
keyStats[code].pressCount++;
|
||||
keyStats[code].startTime = Date.now();
|
||||
pressStartTimes[code] = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
// Set timeout to release key if no repeat events come
|
||||
keyTimeouts[code] = setTimeout(() => {
|
||||
releaseKey(code);
|
||||
}, 150);
|
||||
} else {
|
||||
// In normal mode, only handle keydown if key is not already pressed
|
||||
if (!keys[code]) {
|
||||
keys[code] = true;
|
||||
keyStats[code].pressCount++;
|
||||
keyStats[code].startTime = Date.now();
|
||||
pressStartTimes[code] = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
updateKeyVisuals(code);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function handleKeyUp(event) {
|
||||
const code = event.code;
|
||||
const isRepeatMode = document.getElementById('repeatMode').checked;
|
||||
|
||||
if (!isRepeatMode) {
|
||||
releaseKey(code);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// Initialize all monitored keys
|
||||
const monitoredKeys = ['KeyW', 'KeyA', 'KeyS', 'KeyD', 'ControlLeft', 'Space'];
|
||||
monitoredKeys.forEach(code => {
|
||||
initKeyStats(code);
|
||||
const element = document.getElementById(code);
|
||||
if (element) {
|
||||
element.innerHTML = `${element.getAttribute('data-code').replace('Key', '').replace('Left', '')}<span class="count">0</span>`;
|
||||
}
|
||||
});
|
||||
|
||||
// Start visual updates
|
||||
setInterval(() => {
|
||||
monitoredKeys.forEach(code => {
|
||||
if (keys[code]) {
|
||||
updateKeyVisuals(code);
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
|
||||
// Event listeners
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
document.addEventListener('keyup', handleKeyUp);
|
||||
|
||||
// Handle mode changes
|
||||
document.getElementById('repeatMode').addEventListener('change', () => {
|
||||
// Release all keys when switching modes
|
||||
monitoredKeys.forEach(code => {
|
||||
if (keys[code]) {
|
||||
releaseKey(code);
|
||||
}
|
||||
if (keyTimeouts[code]) {
|
||||
clearTimeout(keyTimeouts[code]);
|
||||
delete keyTimeouts[code];
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 102 B |
|
Before Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 211 B |
|
Before Width: | Height: | Size: 218 B |
|
Before Width: | Height: | Size: 859 KiB After Width: | Height: | Size: 859 KiB |
|
Before Width: | Height: | Size: 952 KiB After Width: | Height: | Size: 952 KiB |
|
Before Width: | Height: | Size: 704 KiB After Width: | Height: | Size: 704 KiB |
|
Before Width: | Height: | Size: 684 KiB After Width: | Height: | Size: 684 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 433 B |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
BIN
assets/extra-textures/loading.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
assets/favicon.ico
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 22 KiB |
1
assets/favicon.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" id="svg143" width="199.005" height="218.204" preserveAspectRatio="xMidYMid meet" version="1.0" viewBox="0 0 149.253 163.653"><metadata id="metadata149"/><path style="fill:#2c7f66;fill-opacity:1;stroke:none;stroke-width:.255102" id="path155" d="M 70.291014,77.896165 C 59.680388,74.213777 22.648767,50.991201 15.537079,47.357179 L 9.6785404,43.882052 12.974329,40.27204 C 14.389438,38.722015 23.848199,31.22073 30.014505,27.519226 48.82918,16.225168 71.327881,6.3561529 74.240859,6.2939037 76.840164,6.2383587 96.296822,13.526104 112.93116,23.22948 c 13.99617,8.164443 25.11609,20.005331 25.11609,21.075841 0,3.35084 -52.956681,34.036172 -60.756373,35.148339 -0.70521,0.10056 -5.712968,-1.110855 -6.999863,-1.557495 z"/><path style="fill:#60a490;fill-opacity:1;stroke:none;stroke-width:.255102" id="path153" d="M 59.762993,152.41877 C 34.273187,139.37619 9.1850164,124.58868 8.1324288,120.62769 7.3477601,117.67491 7.3674123,103.27376 7.1659271,81.577795 6.9735686,60.864542 8.2924714,49.447777 9.6252837,49.191101 c 0.2172937,-0.04185 5.0220853,4.138746 7.3318793,5.356159 12.651207,6.668019 24.238738,15.66922 42.756593,22.261247 l 14.214128,5.059973 -0.07609,38.52563 c -0.03525,17.84928 2.440906,37.45994 -1.830585,34.51479 -0.326872,-0.22538 -2.523682,2.31772 -2.682705,2.31445 -0.15903,-0.003 -6.06786,-3.00979 -9.575513,-4.80458 z"/><path style="fill:#339176;fill-opacity:1;stroke:none;stroke-width:.255102" id="path157" d="m 77.872974,152.91559 c -3.269362,-1.92068 0.03217,-15.1659 -0.262792,-33.00359 L 77.018109,84.108633 86.517737,79.188835 C 101.26896,71.54926 116.64721,64.399959 127.85892,57.115614 c 7.84892,-5.099512 11.87447,-6.243247 12.05109,-5.927453 0.52593,0.940369 3.06033,13.025431 3.28639,25.648089 0.33835,18.892771 -0.64244,41.92455 -2.70182,44.72957 -1.75852,2.39523 -22.6872,14.97537 -35.01436,21.80032 -8.102415,4.4859 -25.563376,11.85455 -26.260778,11.85455 -0.12918,0 -1.346468,-2.3051 -1.346468,-2.3051 z"/><g id="g141" stroke="none" transform="matrix(0.1,0,0,-0.1,-25.6,181.67807)"><path id="path135" fill="#29594b" d="M 875,1778 C 659,1676 371,1501 308,1433 c -44,-46 -52,-113 -52,-433 0,-308 9,-387 47,-428 60,-65 281,-205 506,-319 192,-97 194,-97 384,0 261,133 501,290 525,341 23,51 35,255 29,491 -7,261 -15,306 -60,353 -60,62 -364,248 -547,335 -121,57 -154,58 -265,5 z m 251,-102 c 171,-84 474,-267 474,-285 0,-36 -536,-341 -599,-341 -59,0 -601,305 -601,338 0,31 546,341 601,342 9,0 65,-24 125,-54 z M 445,1236 c 90,-61 266,-161 393,-223 L 950,958 V 624 c 0,-184 -2,-334 -5,-334 -3,0 -40,18 -83,40 -235,121 -470,271 -494,313 -8,15 -13,109 -16,299 -4,287 0,354 21,342 7,-4 39,-26 72,-48 z m 1209,-118 c 9,-227 -6,-462 -31,-491 -21,-24 -203,-144 -318,-209 -83,-47 -241,-128 -250,-128 -3,0 -5,150 -5,334 v 334 l 113,55 c 129,64 301,162 402,230 39,25 73,47 76,47 4,0 10,-78 13,-172 z"/><path id="path137" fill="#29594b" d="m 1540,939 c -57,-23 -110,-94 -110,-148 0,-36 22,-51 74,-51 28,0 36,-4 36,-18 0,-29 -22,-52 -65,-66 -32,-11 -41,-20 -43,-41 -3,-24 -1,-26 20,-20 69,21 132,82 142,139 10,55 -6,76 -59,76 -24,0 -47,5 -50,10 -11,18 23,58 60,71 26,10 35,19 35,36 0,25 -3,26 -40,12 z"/><path id="path139" fill="#29594b" d="m 1358,828 c -13,-10 -17,-37 -20,-131 -3,-109 -5,-120 -26,-137 -21,-18 -31,-60 -13,-60 16,0 61,42 76,70 16,31 22,270 7,270 -5,0 -15,-6 -24,-12 z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
BIN
assets/invsprite.png
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 26 KiB |
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "Minecraft Web Client",
|
||||
"short_name": "Minecraft Web Client",
|
||||
"name": "Prismarine Web Client",
|
||||
"short_name": "Prismarine Web Client",
|
||||
"scope": "./",
|
||||
"start_url": "./",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"sizes": "720x720"
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"background_color": "#349474",
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
<!-- just redirect to /playground/ -->
|
||||
<script>
|
||||
window.location.href = `/playground/${window.location.search}`
|
||||
</script>
|
||||
82
config.json
|
|
@ -1,80 +1,6 @@
|
|||
{
|
||||
"version": 1,
|
||||
"defaultHost": "<from-proxy>",
|
||||
"defaultProxy": "https://proxy.mcraft.fun",
|
||||
"mapsProvider": "https://maps.mcraft.fun/",
|
||||
"skinTexturesProxy": "",
|
||||
"peerJsServer": "",
|
||||
"peerJsServerFallback": "https://p2p.mcraft.fun",
|
||||
"promoteServers": [
|
||||
{
|
||||
"ip": "wss://play.mcraft.fun"
|
||||
},
|
||||
{
|
||||
"ip": "wss://play.webmc.fun",
|
||||
"name": "WebMC"
|
||||
},
|
||||
{
|
||||
"ip": "wss://ws.fuchsmc.net"
|
||||
},
|
||||
{
|
||||
"ip": "wss://play2.mcraft.fun"
|
||||
},
|
||||
{
|
||||
"ip": "wss://play-creative.mcraft.fun",
|
||||
"description": "Might be available soon, stay tuned!"
|
||||
},
|
||||
{
|
||||
"ip": "kaboom.pw",
|
||||
"version": "1.20.3",
|
||||
"description": "Very nice a polite server. Must try for everyone!"
|
||||
}
|
||||
],
|
||||
"rightSideText": "A Minecraft client clone in the browser!",
|
||||
"splashText": "The sunset is coming!",
|
||||
"splashTextFallback": "Welcome!",
|
||||
"pauseLinks": [
|
||||
[
|
||||
{
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"type": "discord"
|
||||
}
|
||||
]
|
||||
],
|
||||
"defaultUsername": "mcrafter{0-9999}",
|
||||
"mobileButtons": [
|
||||
{
|
||||
"action": "general.drop",
|
||||
"actionHold": "general.dropStack",
|
||||
"label": "Q"
|
||||
},
|
||||
{
|
||||
"action": "general.selectItem",
|
||||
"actionHold": "",
|
||||
"label": "S"
|
||||
},
|
||||
{
|
||||
"action": "general.debugOverlay",
|
||||
"actionHold": "general.debugOverlayHelpMenu",
|
||||
"label": "F3"
|
||||
},
|
||||
{
|
||||
"action": "general.playersList",
|
||||
"actionHold": "",
|
||||
"icon": "pixelarticons:users",
|
||||
"label": "TAB"
|
||||
},
|
||||
{
|
||||
"action": "general.chat",
|
||||
"actionHold": "",
|
||||
"label": ""
|
||||
},
|
||||
{
|
||||
"action": "ui.pauseMenu",
|
||||
"actionHold": "",
|
||||
"label": ""
|
||||
}
|
||||
]
|
||||
"defaultHost": "pjs.deptofcraft.com",
|
||||
"defaultProxy": "zardoy.site:2344",
|
||||
"defaultVersion": "1.18.2",
|
||||
"mapsProvider": "zardoy.site/maps"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"alwaysReconnectButton": true,
|
||||
"reportBugButtonWithReconnect": true,
|
||||
"allowAutoConnect": true
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
import { defineConfig } from 'cypress'
|
||||
|
||||
const isPerformanceTest = process.env.PERFORMANCE_TEST === 'true'
|
||||
|
||||
export default defineConfig({
|
||||
video: false,
|
||||
chromeWebSecurity: false,
|
||||
screenshotOnRunFailure: true, // Enable screenshots on test failures
|
||||
e2e: {
|
||||
// We've imported your old cypress plugins here.
|
||||
// You may want to clean this up later by importing these.
|
||||
setupNodeEvents (on, config) {
|
||||
// https://medium.com/automation-with-donald/get-memory-consumption-of-web-app-with-cypress-84e2656e5a0f
|
||||
on('before:browser:launch', (browser = {
|
||||
name: "",
|
||||
family: "chromium",
|
||||
channel: "",
|
||||
displayName: "",
|
||||
version: "",
|
||||
majorVersion: "",
|
||||
path: "",
|
||||
isHeaded: false,
|
||||
isHeadless: false
|
||||
}, launchOptions) => {
|
||||
if (browser.family === 'chromium' && browser.name !== 'electron') {
|
||||
// auto open devtools
|
||||
launchOptions.args.push('--enable-precise-memory-info')
|
||||
}
|
||||
|
||||
return launchOptions
|
||||
|
||||
})
|
||||
|
||||
return require('./cypress/plugins/index.js')(on, config)
|
||||
},
|
||||
baseUrl: 'http://localhost:8080',
|
||||
specPattern: !isPerformanceTest ? 'cypress/e2e/smoke.spec.ts' : 'cypress/e2e/rendering_performance.spec.ts',
|
||||
excludeSpecPattern: ['**/__snapshots__/*', '**/__image_snapshots__/*'],
|
||||
},
|
||||
})
|
||||
11
cypress.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/cypress-io/cypress/188b9a742ee2ef51102167bfd84b3696a3f72a26/cli/schema/cypress.schema.json",
|
||||
"baseUrl": "http://localhost:8080",
|
||||
"testFiles": "**/*.spec.ts",
|
||||
"video": false,
|
||||
"chromeWebSecurity": false,
|
||||
"ignoreTestFiles": [
|
||||
"**/__snapshots__/*",
|
||||
"**/__image_snapshots__/*"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/// <reference types="cypress" />
|
||||
import { BenchmarkAdapterInfo, getAllInfoLines } from '../../src/benchmarkAdapter'
|
||||
import { cleanVisit } from './shared'
|
||||
|
||||
it('Benchmark rendering performance', () => {
|
||||
cleanVisit('/?openBenchmark=true&renderDistance=5')
|
||||
// wait for render end event
|
||||
return cy.document().then({ timeout: 180_000 }, doc => {
|
||||
return new Cypress.Promise(resolve => {
|
||||
cy.log('Waiting for world to load')
|
||||
doc.addEventListener('cypress-world-ready', resolve)
|
||||
}).then(() => {
|
||||
cy.log('World loaded')
|
||||
})
|
||||
}).then(() => {
|
||||
cy.window().then(win => {
|
||||
const adapter = win.benchmarkAdapter as BenchmarkAdapterInfo
|
||||
|
||||
const messages = getAllInfoLines(adapter)
|
||||
// wait for 10 seconds
|
||||
cy.wait(10_000)
|
||||
const messages2 = getAllInfoLines(adapter, true)
|
||||
for (const message of messages) {
|
||||
cy.log(message)
|
||||
}
|
||||
for (const message of messages2) {
|
||||
cy.log(message)
|
||||
}
|
||||
cy.writeFile('benchmark.txt', [...messages, ...messages2].join('\n'))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import { AppOptions } from '../../src/optionsStorage'
|
||||
|
||||
export const cleanVisit = (url?) => {
|
||||
cy.clearLocalStorage()
|
||||
visit(url)
|
||||
window.localStorage.options = {
|
||||
chatOpacity: 0
|
||||
}
|
||||
}
|
||||
export const visit = (url = '/') => {
|
||||
window.localStorage.cypress = 'true'
|
||||
cy.visit(url)
|
||||
}
|
||||
export const setOptions = (options: Partial<AppOptions>) => {
|
||||
cy.window().then(win => {
|
||||
Object.assign(win['options'], options)
|
||||
})
|
||||
}
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/* eslint-disable max-nested-callbacks */
|
||||
/// <reference types="cypress" />
|
||||
import supportedVersions from '../../src/supportedVersions.mjs'
|
||||
import { setOptions, cleanVisit, visit } from './shared'
|
||||
|
||||
// todo use ssl
|
||||
|
||||
const compareRenderedFlatWorld = () => {
|
||||
// wait for render
|
||||
// cy.wait(6000)
|
||||
// cy.get('body').toMatchImageSnapshot({
|
||||
// name: 'superflat-world',
|
||||
// })
|
||||
}
|
||||
|
||||
const testWorldLoad = () => {
|
||||
return cy.document().then({ timeout: 35_000 }, doc => {
|
||||
return new Cypress.Promise(resolve => {
|
||||
doc.addEventListener('cypress-world-ready', resolve)
|
||||
})
|
||||
}).then(() => {
|
||||
compareRenderedFlatWorld()
|
||||
})
|
||||
}
|
||||
|
||||
it('Loads & renders singleplayer', () => {
|
||||
cleanVisit('/?singleplayer=1')
|
||||
setOptions({
|
||||
localServerOptions: {
|
||||
generation: {
|
||||
name: 'superflat',
|
||||
// eslint-disable-next-line unicorn/numeric-separators-style
|
||||
options: { seed: 250869072 }
|
||||
},
|
||||
},
|
||||
renderDistance: 2
|
||||
})
|
||||
testWorldLoad()
|
||||
})
|
||||
|
||||
it.skip('Joins to local flying-squid server', () => {
|
||||
visit('/?ip=localhost&version=1.16.1')
|
||||
window.localStorage.version = ''
|
||||
// todo replace with data-test
|
||||
// cy.get('[data-test-id="servers-screen-button"]').click()
|
||||
// cy.get('[data-test-id="server-ip"]').clear().focus().type('localhost')
|
||||
// cy.get('[data-test-id="version"]').clear().focus().type('1.16.1') // todo needs to fix autoversion
|
||||
cy.get('[data-test-id="connect-qs"]').click() // todo! cypress sometimes doesn't click
|
||||
testWorldLoad()
|
||||
})
|
||||
|
||||
it.skip('Joins to local latest Java vanilla server', () => {
|
||||
const version = supportedVersions.at(-1)!
|
||||
cy.task('startServer', [version, 25_590]).then(() => {
|
||||
visit('/?ip=localhost:25590&username=bot')
|
||||
cy.get('[data-test-id="connect-qs"]').click()
|
||||
testWorldLoad().then(() => {
|
||||
let x = 0
|
||||
let z = 0
|
||||
cy.window().then((win) => {
|
||||
x = win.bot.entity.position.x
|
||||
z = win.bot.entity.position.z
|
||||
})
|
||||
cy.document().trigger('keydown', { code: 'KeyW' })
|
||||
cy.wait(1500).then(() => {
|
||||
cy.document().trigger('keyup', { code: 'KeyW' })
|
||||
cy.window().then(async (win) => {
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
const bot: typeof __type_bot = win.bot
|
||||
// todo use f3 stats instead
|
||||
if (bot.entity.position.x === x && bot.entity.position.z === z) {
|
||||
throw new Error('Player not moved')
|
||||
}
|
||||
|
||||
bot.chat('Hello') // todo assert
|
||||
bot.chat('/gamemode creative')
|
||||
// bot.on('message', () => {
|
||||
void bot.creative.setInventorySlot(bot.inventory.hotbarStart, new win.PrismarineItem(1, 1, 0))
|
||||
// })
|
||||
await bot.lookAt(bot.entity.position.offset(1, 0, 1))
|
||||
}).then(() => {
|
||||
cy.document().trigger('mousedown', { button: 2, isTrusted: true, force: true }) // right click
|
||||
cy.document().trigger('mouseup', { button: 2, isTrusted: true, force: true })
|
||||
cy.wait(1000)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Loads & renders zip world', () => {
|
||||
cleanVisit()
|
||||
cy.get('[data-test-id="select-file-folder"]').click({ shiftKey: true })
|
||||
cy.get('input[type="file"]').selectFile('cypress/superflat.zip', { force: true })
|
||||
testWorldLoad()
|
||||
})
|
||||
|
||||
|
||||
it.skip('Loads & renders world from folder', () => {
|
||||
cleanVisit()
|
||||
// dragndrop folder
|
||||
cy.get('[data-test-id="select-file-folder"]').click()
|
||||
cy.get('input[type="file"]').selectFile('server-jar/world', {
|
||||
force: true,
|
||||
// action: 'drag-drop',
|
||||
})
|
||||
testWorldLoad()
|
||||
})
|
||||
|
Before Width: | Height: | Size: 225 KiB After Width: | Height: | Size: 225 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
79
cypress/integration/index.spec.ts
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/// <reference types="cypress" />
|
||||
import type { AppOptions } from '../../src/optionsStorage'
|
||||
|
||||
const cleanVisit = (url?) => {
|
||||
cy.clearLocalStorage()
|
||||
visit(url)
|
||||
}
|
||||
|
||||
const visit = (url = '/') => {
|
||||
window.localStorage.cypress = 'true'
|
||||
cy.visit(url)
|
||||
}
|
||||
|
||||
// todo use ssl
|
||||
|
||||
const compareRenderedFlatWorld = () => {
|
||||
// wait for render
|
||||
// cy.wait(6000)
|
||||
// cy.get('body').toMatchImageSnapshot({
|
||||
// name: 'superflat-world',
|
||||
// })
|
||||
}
|
||||
|
||||
const testWorldLoad = () => {
|
||||
cy.document().then({ timeout: 20_000 }, doc => {
|
||||
return new Cypress.Promise(resolve => {
|
||||
doc.addEventListener('cypress-world-ready', resolve)
|
||||
})
|
||||
}).then(() => {
|
||||
compareRenderedFlatWorld()
|
||||
})
|
||||
}
|
||||
|
||||
const setOptions = (options: Partial<AppOptions>) => {
|
||||
cy.window().then(win => {
|
||||
Object.assign(win['options'], options)
|
||||
})
|
||||
}
|
||||
|
||||
it('Loads & renders singleplayer', () => {
|
||||
cleanVisit('/?singleplayer=1')
|
||||
setOptions({
|
||||
localServerOptions: {
|
||||
generation: {
|
||||
name: 'superflat',
|
||||
// eslint-disable-next-line unicorn/numeric-separators-style
|
||||
options: { seed: 250869072 }
|
||||
},
|
||||
},
|
||||
renderDistance: 2
|
||||
})
|
||||
testWorldLoad()
|
||||
})
|
||||
|
||||
it.only('Joins to server', () => {
|
||||
// visit('/?version=1.16.1')
|
||||
window.localStorage.version = ''
|
||||
visit()
|
||||
// todo replace with data-test
|
||||
cy.get('[data-test-id="connect-screen-button"]', { includeShadowDom: true }).click()
|
||||
cy.get('input#serverip', { includeShadowDom: true }).clear().focus().type('localhost')
|
||||
cy.get('input#botversion', { includeShadowDom: true }).clear().focus().type('1.16.1') // todo needs to fix autoversion
|
||||
cy.get('[data-test-id="connect-to-server"]', { includeShadowDom: true }).click()
|
||||
testWorldLoad()
|
||||
})
|
||||
|
||||
it('Loads & renders zip world', () => {
|
||||
cleanVisit()
|
||||
cy.get('[data-test-id="select-file-folder"]', { includeShadowDom: true }).click({ shiftKey: true })
|
||||
cy.get('input[type="file"]').selectFile('cypress/superflat.zip', { force: true })
|
||||
testWorldLoad()
|
||||
})
|
||||
|
||||
it.skip('Performance test', () => {
|
||||
// select that world
|
||||
// from -2 85 24
|
||||
// await bot.loadPlugin(pathfinder.pathfinder)
|
||||
// bot.pathfinder.goto(new pathfinder.goals.GoalXZ(28, -28))
|
||||
})
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
//@ts-check
|
||||
import mcServer from 'flying-squid'
|
||||
import defaultOptions from 'flying-squid/config/default-settings.json' with { type: 'json' }
|
||||
import defaultOptions from 'flying-squid/config/default-settings.json' assert { type: 'json' }
|
||||
|
||||
/** @type {Options} */
|
||||
const serverOptions = {
|
||||
...defaultOptions,
|
||||
'online-mode': false,
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@
|
|||
const { cypressEsbuildPreprocessor } = require('cypress-esbuild-preprocessor')
|
||||
const { initPlugin } = require('cypress-plugin-snapshots/plugin')
|
||||
const polyfill = require('esbuild-plugin-polyfill-node')
|
||||
const { startMinecraftServer } = require('./startServer')
|
||||
|
||||
module.exports = (on, config) => {
|
||||
initPlugin(on, config)
|
||||
on('file:preprocessor', cypressEsbuildPreprocessor({
|
||||
esbuildOptions: {
|
||||
sourcemap: true,
|
||||
plugins: [
|
||||
polyfill.polyfillNode({
|
||||
polyfills: {
|
||||
|
|
@ -19,15 +17,10 @@ module.exports = (on, config) => {
|
|||
},
|
||||
}))
|
||||
on('task', {
|
||||
log(message) {
|
||||
log (message) {
|
||||
console.log(message)
|
||||
return null
|
||||
},
|
||||
})
|
||||
on('task', {
|
||||
async startServer([version, port]) {
|
||||
return startMinecraftServer(version, port)
|
||||
}
|
||||
})
|
||||
return config
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
[
|
||||
{
|
||||
"uuid": "67128b5b-2e6b-3ad1-baa0-1b937b03e5c5",
|
||||
"name": "bot",
|
||||
"level": 4,
|
||||
"bypassesPlayerLimit": false
|
||||
}
|
||||
]
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
#Minecraft server properties
|
||||
allow-flight=false
|
||||
allow-nether=true
|
||||
broadcast-console-to-ops=true
|
||||
broadcast-rcon-to-ops=true
|
||||
difficulty=peaceful
|
||||
enable-command-block=false
|
||||
enable-jmx-monitoring=false
|
||||
enable-query=false
|
||||
enable-rcon=false
|
||||
enable-status=true
|
||||
enforce-secure-profile=true
|
||||
enforce-whitelist=false
|
||||
entity-broadcast-range-percentage=100
|
||||
force-gamemode=false
|
||||
function-permission-level=2
|
||||
gamemode=survival
|
||||
generate-structures=true
|
||||
generator-settings={}
|
||||
hardcore=false
|
||||
hide-online-players=false
|
||||
initial-disabled-packs=
|
||||
initial-enabled-packs=vanilla
|
||||
level-name=world
|
||||
level-seed=
|
||||
level-type=flat
|
||||
log-ips=true
|
||||
max-build-height=256
|
||||
max-chained-neighbor-updates=1000000
|
||||
max-players=20
|
||||
max-tick-time=60000
|
||||
max-world-size=29999984
|
||||
motd=A Minecraft Server
|
||||
network-compression-threshold=256
|
||||
online-mode=false
|
||||
op-permission-level=4
|
||||
player-idle-timeout=0
|
||||
prevent-proxy-connections=false
|
||||
pvp=true
|
||||
query.port=25565
|
||||
rate-limit=0
|
||||
rcon.password=
|
||||
rcon.port=25575
|
||||
require-resource-pack=false
|
||||
resource-pack=
|
||||
resource-pack-id=
|
||||
resource-pack-prompt=
|
||||
resource-pack-sha1=
|
||||
server-ip=
|
||||
server-port=25565
|
||||
simulation-distance=10
|
||||
snooper-enabled=true
|
||||
spawn-animals=true
|
||||
spawn-monsters=true
|
||||
spawn-npcs=true
|
||||
spawn-protection=16
|
||||
sync-chunk-writes=true
|
||||
text-filtering-config=
|
||||
use-native-transport=true
|
||||
view-distance=10
|
||||
white-list=false
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
import { ChildProcess, spawn } from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { promisify } from 'util'
|
||||
import { downloadServer } from 'minecraft-wrap'
|
||||
import * as waitOn from 'wait-on'
|
||||
|
||||
let prevProcess: ChildProcess | null = null
|
||||
export const startMinecraftServer = async (version: string, port: number) => {
|
||||
if (prevProcess) return null
|
||||
const jar = `./server-jar/${version}.jar`
|
||||
|
||||
const start = () => {
|
||||
// if (prevProcess) {
|
||||
// prevProcess.kill()
|
||||
// }
|
||||
|
||||
prevProcess = spawn('java', ['-jar', path.basename(jar), 'nogui', '--port', `${port}`], {
|
||||
stdio: 'inherit',
|
||||
cwd: path.dirname(jar),
|
||||
})
|
||||
}
|
||||
|
||||
let coldStart = false
|
||||
if (fs.existsSync(jar)) {
|
||||
start()
|
||||
} else {
|
||||
coldStart = true
|
||||
promisify(downloadServer)(version, jar).then(() => {
|
||||
// add eula.txt
|
||||
fs.writeFileSync(path.join(path.dirname(jar), 'eula.txt'), 'eula=true')
|
||||
// copy cypress/plugins/server.properties
|
||||
fs.copyFileSync(path.join(__dirname, 'server.properties'), path.join(path.dirname(jar), 'server.properties'))
|
||||
// copy ops.json
|
||||
fs.copyFileSync(path.join(__dirname, 'ops.json'), path.join(path.dirname(jar), 'ops.json'))
|
||||
start()
|
||||
})
|
||||
}
|
||||
|
||||
return new Promise<null>((res) => {
|
||||
waitOn({ resources: [`tcp:localhost:${port}`] }, () => {
|
||||
setTimeout(() => res(null), coldStart ? 6500 : 2000) // todo retry instead of timeout
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Before Width: | Height: | Size: 217 KiB |
|
|
@ -1,169 +0,0 @@
|
|||
# Handled Packets
|
||||
|
||||
## Server -> Client
|
||||
|
||||
❌ statistics
|
||||
❌ advancements
|
||||
❌ face_player
|
||||
❌ nbt_query_response
|
||||
❌ chat_suggestions
|
||||
❌ trade_list
|
||||
❌ vehicle_move
|
||||
❌ open_book
|
||||
❌ craft_recipe_response
|
||||
❌ end_combat_event
|
||||
❌ enter_combat_event
|
||||
❌ unlock_recipes
|
||||
❌ camera
|
||||
❌ update_view_position
|
||||
❌ update_view_distance
|
||||
❌ entity_sound_effect
|
||||
❌ stop_sound
|
||||
❌ feature_flags
|
||||
❌ select_advancement_tab
|
||||
❌ declare_recipes
|
||||
❌ tags
|
||||
❌ acknowledge_player_digging
|
||||
❌ initialize_world_border
|
||||
❌ world_border_center
|
||||
❌ world_border_lerp_size
|
||||
❌ world_border_size
|
||||
❌ world_border_warning_delay
|
||||
❌ world_border_warning_reach
|
||||
❌ simulation_distance
|
||||
❌ chunk_biomes
|
||||
❌ hurt_animation
|
||||
✅ damage_event
|
||||
✅ spawn_entity
|
||||
✅ spawn_entity_experience_orb
|
||||
✅ named_entity_spawn
|
||||
✅ animation
|
||||
✅ block_break_animation
|
||||
✅ tile_entity_data
|
||||
✅ block_action
|
||||
✅ block_change
|
||||
✅ boss_bar
|
||||
✅ difficulty
|
||||
✅ tab_complete
|
||||
✅ declare_commands
|
||||
✅ multi_block_change
|
||||
✅ close_window
|
||||
✅ open_window
|
||||
✅ window_items
|
||||
✅ craft_progress_bar
|
||||
✅ set_slot
|
||||
✅ set_cooldown
|
||||
✅ custom_payload
|
||||
✅ hide_message
|
||||
✅ kick_disconnect
|
||||
✅ profileless_chat
|
||||
✅ entity_status
|
||||
✅ explosion
|
||||
✅ unload_chunk
|
||||
✅ game_state_change
|
||||
✅ open_horse_window
|
||||
✅ keep_alive
|
||||
✅ map_chunk
|
||||
✅ world_event
|
||||
✅ world_particles
|
||||
✅ update_light
|
||||
✅ login
|
||||
✅ map
|
||||
✅ rel_entity_move
|
||||
✅ entity_move_look
|
||||
✅ entity_look
|
||||
✅ open_sign_entity
|
||||
✅ abilities
|
||||
✅ player_chat
|
||||
✅ death_combat_event
|
||||
✅ player_remove
|
||||
✅ player_info
|
||||
✅ position
|
||||
✅ entity_destroy
|
||||
✅ remove_entity_effect
|
||||
✅ resource_pack_send
|
||||
✅ respawn
|
||||
✅ entity_head_rotation
|
||||
✅ held_item_slot
|
||||
✅ scoreboard_display_objective
|
||||
✅ entity_metadata
|
||||
✅ attach_entity
|
||||
✅ entity_velocity
|
||||
✅ entity_equipment
|
||||
✅ experience
|
||||
✅ update_health
|
||||
✅ scoreboard_objective
|
||||
✅ set_passengers
|
||||
✅ teams
|
||||
✅ scoreboard_score
|
||||
✅ spawn_position
|
||||
✅ update_time
|
||||
✅ sound_effect
|
||||
✅ system_chat
|
||||
✅ playerlist_header
|
||||
✅ collect
|
||||
✅ entity_teleport
|
||||
✅ entity_update_attributes
|
||||
✅ entity_effect
|
||||
✅ server_data
|
||||
✅ clear_titles
|
||||
✅ action_bar
|
||||
✅ ping
|
||||
✅ set_title_subtitle
|
||||
✅ set_title_text
|
||||
✅ set_title_time
|
||||
✅ packet
|
||||
|
||||
## Client -> Server
|
||||
|
||||
❌ query_block_nbt
|
||||
❌ set_difficulty
|
||||
❌ query_entity_nbt
|
||||
❌ pick_item
|
||||
❌ set_beacon_effect
|
||||
❌ update_command_block_minecart
|
||||
❌ update_structure_block
|
||||
❌ generate_structure
|
||||
❌ lock_difficulty
|
||||
❌ craft_recipe_request
|
||||
❌ displayed_recipe
|
||||
❌ recipe_book
|
||||
❌ update_jigsaw_block
|
||||
❌ spectate
|
||||
❌ advancement_tab
|
||||
✅ teleport_confirm
|
||||
✅ chat_command
|
||||
✅ chat_message
|
||||
✅ message_acknowledgement
|
||||
✅ edit_book
|
||||
✅ name_item
|
||||
✅ select_trade
|
||||
✅ update_command_block
|
||||
✅ tab_complete
|
||||
✅ client_command
|
||||
✅ settings
|
||||
✅ enchant_item
|
||||
✅ window_click
|
||||
✅ close_window
|
||||
✅ custom_payload
|
||||
✅ use_entity
|
||||
✅ keep_alive
|
||||
✅ position
|
||||
✅ position_look
|
||||
✅ look
|
||||
✅ flying
|
||||
✅ vehicle_move
|
||||
✅ steer_boat
|
||||
✅ abilities
|
||||
✅ block_dig
|
||||
✅ entity_action
|
||||
✅ steer_vehicle
|
||||
✅ resource_pack_receive
|
||||
✅ held_item_slot
|
||||
✅ set_creative_slot
|
||||
✅ update_sign
|
||||
✅ arm_animation
|
||||
✅ block_place
|
||||
✅ use_item
|
||||
✅ pong
|
||||
✅ chat_session_update
|
||||
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 24 KiB |
126
esbuild.mjs
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
//@ts-check
|
||||
import * as esbuild from 'esbuild'
|
||||
import fs from 'fs'
|
||||
// import htmlPlugin from '@chialab/esbuild-plugin-html'
|
||||
import server from './server.js'
|
||||
import { clients, plugins } from './scripts/esbuildPlugins.mjs'
|
||||
import { generateSW } from 'workbox-build'
|
||||
import { getSwAdditionalEntries } from './scripts/build.js'
|
||||
import { build } from 'esbuild'
|
||||
|
||||
//@ts-ignore
|
||||
try { await import('./localSettings.mjs') } catch { }
|
||||
|
||||
fs.writeFileSync('dist/index.html', fs.readFileSync('index.html', 'utf8').replace('<!-- inject script -->', '<script src="index.js"></script>'), 'utf8')
|
||||
|
||||
const watch = process.argv.includes('--watch') || process.argv.includes('-w')
|
||||
const prod = process.argv.includes('--prod')
|
||||
const dev = !prod
|
||||
|
||||
const banner = [
|
||||
'window.global = globalThis;',
|
||||
// report reload time
|
||||
dev && 'if (sessionStorage.lastReload) { const [rebuild, reloadStart] = sessionStorage.lastReload.split(","); const now = Date.now(); console.log(`rebuild + reload:`, +rebuild, "+", now - reloadStart, "=", ((+rebuild + (now - reloadStart)) / 1000).toFixed(1) + "s");sessionStorage.lastReload = ""; }',
|
||||
// auto-reload
|
||||
dev && 'window.noAutoReload ??= false;(() => new EventSource("/esbuild").onmessage = ({ data: _data }) => { if (!_data) return; const data = JSON.parse(_data); if (!data.update) return;console.log("[esbuild] Page is outdated");document.title = `[O] ${document.title}`;if (window.noAutoReload || localStorage.noAutoReload) return; if (localStorage.autoReloadVisible && document.visibilityState !== "visible") return; sessionStorage.lastReload = `${data.update.time},${Date.now()}`; location.reload() })();'
|
||||
].filter(Boolean)
|
||||
|
||||
const buildingVersion = new Date().toISOString().split(':')[0]
|
||||
|
||||
/** @type {import('esbuild').BuildOptions} */
|
||||
const buildOptions = {
|
||||
bundle: true,
|
||||
entryPoints: ['src/index.ts'],
|
||||
target: ['es2020'],
|
||||
jsx: 'automatic',
|
||||
jsxDev: dev,
|
||||
// logLevel: 'debug',
|
||||
logLevel: 'info',
|
||||
platform: 'browser',
|
||||
sourcemap: prod ? true : 'inline',
|
||||
outdir: 'dist',
|
||||
mainFields: [
|
||||
'browser', 'module', 'main'
|
||||
],
|
||||
keepNames: true,
|
||||
banner: {
|
||||
// using \n breaks sourcemaps!
|
||||
js: banner.join(';'),
|
||||
},
|
||||
alias: {
|
||||
events: 'events', // make explicit
|
||||
buffer: 'buffer',
|
||||
'fs': 'browserfs/dist/shims/fs.js',
|
||||
http: 'http-browserify',
|
||||
perf_hooks: './src/perf_hooks_replacement.js',
|
||||
crypto: './src/crypto.js',
|
||||
stream: 'stream-browserify',
|
||||
net: 'net-browserify',
|
||||
assert: 'assert',
|
||||
dns: './src/dns.js'
|
||||
},
|
||||
inject: [
|
||||
'./src/shims.js'
|
||||
],
|
||||
metafile: true,
|
||||
plugins,
|
||||
sourcesContent: !process.argv.includes('--no-sources'),
|
||||
minify: process.argv.includes('--minify'),
|
||||
define: {
|
||||
'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}`}`)
|
||||
},
|
||||
loader: {
|
||||
// todo use external or resolve issues with duplicating
|
||||
'.png': 'dataurl',
|
||||
'.map': 'empty'
|
||||
},
|
||||
write: false,
|
||||
// todo would be better to enable?
|
||||
// preserveSymlinks: true,
|
||||
}
|
||||
|
||||
if (watch) {
|
||||
const ctx = await esbuild.context(buildOptions)
|
||||
await ctx.watch()
|
||||
server.app.get('/esbuild', (req, res, next) => {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/event-stream',
|
||||
'Cache-Control': 'no-cache',
|
||||
Connection: 'keep-alive',
|
||||
})
|
||||
|
||||
// Send a comment to keep the connection alive
|
||||
res.write(': ping\n\n')
|
||||
|
||||
// Add the client response to the clients array
|
||||
clients.push(res)
|
||||
|
||||
// Handle any client disconnection logic
|
||||
res.on('close', () => {
|
||||
const index = clients.indexOf(res)
|
||||
if (index !== -1) {
|
||||
clients.splice(index, 1)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
const result = await build(buildOptions)
|
||||
// console.log(await esbuild.analyzeMetafile(result.metafile))
|
||||
|
||||
if (prod) {
|
||||
fs.writeFileSync('dist/version.txt', buildingVersion, 'utf-8')
|
||||
|
||||
const { count, size, warnings } = await generateSW({
|
||||
// dontCacheBustURLsMatching: [new RegExp('...')],
|
||||
globDirectory: 'dist',
|
||||
skipWaiting: true,
|
||||
clientsClaim: true,
|
||||
additionalManifestEntries: getSwAdditionalEntries(),
|
||||
globPatterns: [],
|
||||
swDest: 'dist/service-worker.js',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
import React, { useState } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import {
|
||||
Button,
|
||||
Slider,
|
||||
ArmorBar,
|
||||
BreathBar,
|
||||
Chat,
|
||||
HealthBar,
|
||||
PlayerListOverlay,
|
||||
Scoreboard,
|
||||
MessageFormattedString,
|
||||
XPBar,
|
||||
FoodBar
|
||||
} from '../dist-npm'
|
||||
|
||||
const ExampleDemo = () => {
|
||||
const [sliderValue, setSliderValue] = useState(0)
|
||||
|
||||
return (
|
||||
<div style={{ scale: '2', transformOrigin: 'top left', width: '50%', height: '50dvh', fontFamily: 'mojangles, sans-serif', background: 'gray' }}>
|
||||
<Button>Button</Button>
|
||||
<Slider label="Slider" value={sliderValue} updateValue={value => setSliderValue(value)} />
|
||||
<ArmorBar armorValue={10} />
|
||||
<Chat
|
||||
messages={[
|
||||
{ id: 0, parts: [{ text: 'A formmated message in the chat', color: 'blue' }] },
|
||||
{ id: 1, parts: [{ text: 'An other message in the chat', color: 'red' }] },
|
||||
]}
|
||||
usingTouch={false}
|
||||
opened
|
||||
sendMessage={message => {
|
||||
console.log('typed', message)
|
||||
// close
|
||||
}}
|
||||
/>
|
||||
<BreathBar oxygen={10} />
|
||||
<HealthBar isHardcore={false} healthValue={10} damaged={false} />
|
||||
<FoodBar food={10} />
|
||||
<PlayerListOverlay
|
||||
style={{
|
||||
position: 'static',
|
||||
}}
|
||||
clientId="" // needed for current player highlight
|
||||
serverIP="Server IP"
|
||||
tablistHeader="Tab §aHeader"
|
||||
tablistFooter="Tab §bFooter"
|
||||
playersLists={[
|
||||
[
|
||||
{ username: 'Player 1', ping: 10, uuid: undefined },
|
||||
{ username: 'Player 2', ping: 20, uuid: undefined },
|
||||
{ username: 'Player 3', ping: 30, uuid: undefined },
|
||||
],
|
||||
]}
|
||||
/>
|
||||
"§bRed" displays as <MessageFormattedString message="§bRed" />
|
||||
<Scoreboard
|
||||
open
|
||||
title="Scoreboard"
|
||||
items={[
|
||||
{ name: 'Player 1', value: 10 },
|
||||
{ name: 'Player 2', value: 20 },
|
||||
{ name: 'Player 3', value: 30 },
|
||||
]}
|
||||
/>
|
||||
<XPBar gamemode="survival" level={10} progress={0.5} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
createRoot(document.body as Element).render(<ExampleDemo />)
|
||||
|
|
@ -1 +0,0 @@
|
|||
<script src="decode.ts" type="module"></script>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
// Include the pako library
|
||||
import pako from 'pako';
|
||||
import compressedJsRaw from './compressed.js?raw'
|
||||
|
||||
function decompressFromBase64(input) {
|
||||
// Decode the Base64 string
|
||||
const binaryString = atob(input);
|
||||
const len = binaryString.length;
|
||||
const bytes = new Uint8Array(len);
|
||||
|
||||
// Convert the binary string to a byte array
|
||||
for (let i = 0; i < len; i++) {
|
||||
bytes[i] = binaryString.charCodeAt(i);
|
||||
}
|
||||
|
||||
// Decompress the byte array
|
||||
const decompressedData = pako.inflate(bytes, { to: 'string' });
|
||||
|
||||
return decompressedData;
|
||||
}
|
||||
|
||||
// Use the function
|
||||
console.time('decompress');
|
||||
const decompressedData = decompressFromBase64(compressedJsRaw);
|
||||
console.timeEnd('decompress')
|
||||
console.log(decompressedData)
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
bottom: env(safe-area-inset-bottom);
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #f00;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
<span>bottom: env(safe-area-inset-bottom)</span>
|
||||
</div>
|
||||
|
|
@ -1 +0,0 @@
|
|||
<script src="state.ts" type="module"></script>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
import { SmoothSwitcher } from '../renderer/viewer/lib/smoothSwitcher'
|
||||
|
||||
const div = document.createElement('div')
|
||||
div.style.width = '100px'
|
||||
div.style.height = '100px'
|
||||
div.style.backgroundColor = 'red'
|
||||
document.body.appendChild(div)
|
||||
|
||||
const pos = {x: 0, y: 0}
|
||||
|
||||
const positionSwitcher = new SmoothSwitcher(() => pos, (key, value) => {
|
||||
pos[key] = value
|
||||
})
|
||||
globalThis.positionSwitcher = positionSwitcher
|
||||
|
||||
document.body.addEventListener('keydown', e => {
|
||||
if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') {
|
||||
const to = {
|
||||
x: e.code === 'ArrowLeft' ? -100 : 100
|
||||
}
|
||||
console.log(pos, to)
|
||||
positionSwitcher.transitionTo(to, e.code === 'ArrowLeft' ? 'Left' : 'Right', () => {
|
||||
console.log('Switched to ', e.code === 'ArrowLeft' ? 'Left' : 'Right')
|
||||
})
|
||||
}
|
||||
if (e.code === 'Space') {
|
||||
pos.x = 200
|
||||
}
|
||||
})
|
||||
|
||||
const render = () => {
|
||||
positionSwitcher.update()
|
||||
div.style.transform = `translate(${pos.x}px, ${pos.y}px)`
|
||||
requestAnimationFrame(render)
|
||||
}
|
||||
|
||||
render()
|
||||
60
experiments/texture-render.html
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script type="module">
|
||||
//@ts-check
|
||||
import blockImg from '../prismarine-viewer/public/textures/1.16.1.png'
|
||||
import blocksStates from '../prismarine-viewer/public/blocksStates/1.16.1.json'
|
||||
|
||||
// const block = {
|
||||
// name: 'oak_sign',
|
||||
// variant: 0,
|
||||
// elem: 1,
|
||||
// face: 'up'
|
||||
// }
|
||||
const block = {
|
||||
name: 'light_gray_stained_glass',
|
||||
variant: 0,
|
||||
elem: 0,
|
||||
face: 'north'
|
||||
}
|
||||
//@ts-ignore
|
||||
const model = Object.entries(blocksStates[block.name].variants).find((a, i) => typeof block.variant === 'number' ? i === block.variant : a === block.variant)[1].model.elements[block.elem]
|
||||
console.log(model)
|
||||
const textureUv = model.faces[block.face].texture
|
||||
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.style.imageRendering = 'pixelated'
|
||||
document.body.appendChild(canvas)
|
||||
const factor = 50
|
||||
const modelWidth = model.to[0] - model.from[0]
|
||||
const modelHeight = model.to[1] - model.from[1]
|
||||
canvas.width = modelWidth * factor
|
||||
canvas.height = modelHeight * factor
|
||||
// canvas.width = 16 * factor
|
||||
// canvas.height = 16 * factor * 2
|
||||
|
||||
const ctx = canvas.getContext('2d')
|
||||
//@ts-ignore
|
||||
ctx.imageSmoothingEnabled = false
|
||||
const img = new Image()
|
||||
const img2 = new Image()
|
||||
img.src = blockImg
|
||||
img.onload = () => {
|
||||
//@ts-ignore
|
||||
ctx.drawImage(img, img.width * textureUv.u, img.height * textureUv.v, img.width * textureUv.su, img.height * textureUv.sv, 0, 0, canvas.width, canvas.height)
|
||||
// ctx.drawImage(img, 0, 0, canvas.width, canvas.height / 2)
|
||||
console.log('width;height texture', img.width * textureUv.su, img.height * textureUv.sv)
|
||||
console.log('base su=sv', 16 / img.width)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Minecraft Item Viewer</title>
|
||||
<style>
|
||||
body { margin: 0; overflow: hidden; }
|
||||
canvas { display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module" src="./three-item.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
import * as THREE from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
import itemsAtlas from 'mc-assets/dist/itemsAtlasLegacy.png'
|
||||
import { createItemMeshFromCanvas, createItemMesh } from '../renderer/viewer/three/itemMesh'
|
||||
|
||||
// Create scene, camera and renderer
|
||||
const scene = new THREE.Scene()
|
||||
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000)
|
||||
const renderer = new THREE.WebGLRenderer({ antialias: true })
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
document.body.appendChild(renderer.domElement)
|
||||
|
||||
// Setup camera and controls
|
||||
camera.position.set(0, 0, 3)
|
||||
const controls = new OrbitControls(camera, renderer.domElement)
|
||||
controls.enableDamping = true
|
||||
|
||||
// Background and lights
|
||||
scene.background = new THREE.Color(0x333333)
|
||||
const ambientLight = new THREE.AmbientLight(0xffffff, 0.7)
|
||||
scene.add(ambientLight)
|
||||
|
||||
// Animation loop
|
||||
function animate () {
|
||||
requestAnimationFrame(animate)
|
||||
controls.update()
|
||||
renderer.render(scene, camera)
|
||||
}
|
||||
|
||||
async function setupItemMesh () {
|
||||
try {
|
||||
const loader = new THREE.TextureLoader()
|
||||
const atlasTexture = await loader.loadAsync(itemsAtlas)
|
||||
|
||||
// Pixel-art configuration
|
||||
atlasTexture.magFilter = THREE.NearestFilter
|
||||
atlasTexture.minFilter = THREE.NearestFilter
|
||||
atlasTexture.generateMipmaps = false
|
||||
atlasTexture.wrapS = atlasTexture.wrapT = THREE.ClampToEdgeWrapping
|
||||
|
||||
// Extract the tile at x=2, y=0 (16x16)
|
||||
const tileSize = 16
|
||||
const tileX = 2
|
||||
const tileY = 0
|
||||
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = tileSize
|
||||
canvas.height = tileSize
|
||||
const ctx = canvas.getContext('2d')!
|
||||
|
||||
ctx.imageSmoothingEnabled = false
|
||||
ctx.drawImage(
|
||||
atlasTexture.image,
|
||||
tileX * tileSize,
|
||||
tileY * tileSize,
|
||||
tileSize,
|
||||
tileSize,
|
||||
0,
|
||||
0,
|
||||
tileSize,
|
||||
tileSize
|
||||
)
|
||||
|
||||
// Test both approaches - working manual extraction:
|
||||
const meshOld = createItemMeshFromCanvas(canvas, { depth: 0.1 })
|
||||
meshOld.position.x = -1
|
||||
meshOld.rotation.x = -Math.PI / 12
|
||||
meshOld.rotation.y = Math.PI / 12
|
||||
scene.add(meshOld)
|
||||
|
||||
// And new unified function:
|
||||
const atlasWidth = atlasTexture.image.width
|
||||
const atlasHeight = atlasTexture.image.height
|
||||
const u = (tileX * tileSize) / atlasWidth
|
||||
const v = (tileY * tileSize) / atlasHeight
|
||||
const sizeX = tileSize / atlasWidth
|
||||
const sizeY = tileSize / atlasHeight
|
||||
|
||||
console.log('Debug texture coords:', {u, v, sizeX, sizeY, atlasWidth, atlasHeight})
|
||||
|
||||
const resultNew = createItemMesh(atlasTexture, {
|
||||
u, v, sizeX, sizeY
|
||||
}, {
|
||||
faceCamera: false,
|
||||
use3D: true,
|
||||
depth: 0.1
|
||||
})
|
||||
|
||||
resultNew.mesh.position.x = 1
|
||||
resultNew.mesh.rotation.x = -Math.PI / 12
|
||||
resultNew.mesh.rotation.y = Math.PI / 12
|
||||
scene.add(resultNew.mesh)
|
||||
|
||||
animate()
|
||||
} catch (err) {
|
||||
console.error('Failed to create item mesh:', err)
|
||||
}
|
||||
}
|
||||
|
||||
// Handle window resize
|
||||
window.addEventListener('resize', () => {
|
||||
camera.aspect = window.innerWidth / window.innerHeight
|
||||
camera.updateProjectionMatrix()
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
})
|
||||
|
||||
// Start
|
||||
setupItemMesh()
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<script type="module" src="three-labels.ts"></script>
|
||||
<style>
|
||||
body { margin: 0; }
|
||||
canvas { display: block; }
|
||||
</style>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
import * as THREE from 'three'
|
||||
import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'
|
||||
import { createWaypointSprite, WAYPOINT_CONFIG } from '../renderer/viewer/three/waypointSprite'
|
||||
|
||||
// Create scene, camera and renderer
|
||||
const scene = new THREE.Scene()
|
||||
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000)
|
||||
const renderer = new THREE.WebGLRenderer({ antialias: true })
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
document.body.appendChild(renderer.domElement)
|
||||
|
||||
// Add FirstPersonControls
|
||||
const controls = new FirstPersonControls(camera, renderer.domElement)
|
||||
controls.lookSpeed = 0.1
|
||||
controls.movementSpeed = 10
|
||||
controls.lookVertical = true
|
||||
controls.constrainVertical = true
|
||||
controls.verticalMin = 0.1
|
||||
controls.verticalMax = Math.PI - 0.1
|
||||
|
||||
// Position camera
|
||||
camera.position.y = 1.6 // Typical eye height
|
||||
camera.lookAt(0, 1.6, -1)
|
||||
|
||||
// Create a helper grid and axes
|
||||
const grid = new THREE.GridHelper(20, 20)
|
||||
scene.add(grid)
|
||||
const axes = new THREE.AxesHelper(5)
|
||||
scene.add(axes)
|
||||
|
||||
// Create waypoint sprite via utility
|
||||
const waypoint = createWaypointSprite({
|
||||
position: new THREE.Vector3(0, 0, -5),
|
||||
color: 0xff0000,
|
||||
label: 'Target',
|
||||
})
|
||||
scene.add(waypoint.group)
|
||||
|
||||
// Use built-in offscreen arrow from utils
|
||||
waypoint.enableOffscreenArrow(true)
|
||||
waypoint.setArrowParent(scene)
|
||||
|
||||
// Animation loop
|
||||
function animate() {
|
||||
requestAnimationFrame(animate)
|
||||
|
||||
const delta = Math.min(clock.getDelta(), 0.1)
|
||||
controls.update(delta)
|
||||
|
||||
// Unified camera update (size, distance text, arrow, visibility)
|
||||
const sizeVec = renderer.getSize(new THREE.Vector2())
|
||||
waypoint.updateForCamera(camera.position, camera, sizeVec.width, sizeVec.height)
|
||||
|
||||
renderer.render(scene, camera)
|
||||
}
|
||||
|
||||
// Handle window resize
|
||||
window.addEventListener('resize', () => {
|
||||
camera.aspect = window.innerWidth / window.innerHeight
|
||||
camera.updateProjectionMatrix()
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
})
|
||||
|
||||
// Add clock for controls
|
||||
const clock = new THREE.Clock()
|
||||
|
||||
animate()
|
||||
|
|
@ -1 +0,0 @@
|
|||
<script type="module" src="three.ts"></script>
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
import * as THREE from 'three'
|
||||
|
||||
// Create scene, camera and renderer
|
||||
const scene = new THREE.Scene()
|
||||
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000)
|
||||
const renderer = new THREE.WebGLRenderer()
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
document.body.appendChild(renderer.domElement)
|
||||
|
||||
// Position camera
|
||||
camera.position.z = 5
|
||||
|
||||
// Create a canvas with some content
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = 256
|
||||
canvas.height = 256
|
||||
const ctx = canvas.getContext('2d')
|
||||
|
||||
scene.background = new THREE.Color(0x444444)
|
||||
|
||||
// Draw something on the canvas
|
||||
ctx.fillStyle = '#444444'
|
||||
// ctx.fillRect(0, 0, 256, 256)
|
||||
ctx.fillStyle = 'red'
|
||||
ctx.font = '48px Arial'
|
||||
ctx.textAlign = 'center'
|
||||
ctx.textBaseline = 'middle'
|
||||
ctx.fillText('Hello!', 128, 128)
|
||||
|
||||
// Create bitmap and texture
|
||||
async function createTexturedBox() {
|
||||
const canvas2 = new OffscreenCanvas(256, 256)
|
||||
const ctx2 = canvas2.getContext('2d')!
|
||||
ctx2.drawImage(canvas, 0, 0)
|
||||
const texture = new THREE.Texture(canvas2)
|
||||
texture.magFilter = THREE.NearestFilter
|
||||
texture.minFilter = THREE.NearestFilter
|
||||
texture.needsUpdate = true
|
||||
texture.flipY = false
|
||||
|
||||
// Create box with texture
|
||||
const geometry = new THREE.BoxGeometry(2, 2, 2)
|
||||
const material = new THREE.MeshBasicMaterial({
|
||||
map: texture,
|
||||
side: THREE.DoubleSide,
|
||||
premultipliedAlpha: false,
|
||||
})
|
||||
const cube = new THREE.Mesh(geometry, material)
|
||||
scene.add(cube)
|
||||
}
|
||||
|
||||
// Create the textured box
|
||||
createTexturedBox()
|
||||
|
||||
// Animation loop
|
||||
function animate() {
|
||||
requestAnimationFrame(animate)
|
||||
renderer.render(scene, camera)
|
||||
}
|
||||
animate()
|
||||
155
index.html
|
|
@ -1,119 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="darkreader-lock">
|
||||
<script>
|
||||
window.startLoad = Date.now()
|
||||
// g663 fix: forbid change of string prototype
|
||||
Object.defineProperty(String.prototype, 'format', {
|
||||
writable: false,
|
||||
configurable: false
|
||||
});
|
||||
Object.defineProperty(String.prototype, 'replaceAll', {
|
||||
writable: false,
|
||||
configurable: false
|
||||
});
|
||||
</script>
|
||||
<!-- // #region initial loader -->
|
||||
<script async>
|
||||
const loadingDiv = /* html */ `
|
||||
<div class="initial-loader" style="position: fixed;transition:opacity 0.2s;inset: 0;background:black;display: flex;justify-content: center;align-items: center;font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', Arial, Helvetica, sans-serif;gap: 15px;" ontransitionend="this.remove()">
|
||||
<div>
|
||||
<img src="./loading-bg.jpg" alt="Prismarine Web Client" style="position:fixed;inset:0;width:100%;height:100%;z-index: -2;object-fit: cover;filter: blur(3px);">
|
||||
<div style="position: fixed;inset: 0;z-index: -1;background-color: rgba(0, 0, 0, 0.8);"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-size: calc(var(--font-size) * 1.8);color: lightgray;" class="title">Loading...</div>
|
||||
<div style="font-size: var(--font-size);color: rgb(176, 176, 176);margin-top: 3px;text-align: center" class="subtitle">A true Minecraft client in your browser!</div>
|
||||
<!-- small text pre -->
|
||||
<div style="font-size: calc(var(--font-size) * 0.6);color: rgb(150, 150, 150);margin-top: 3px;text-align: center;white-space: pre-line;" class="advanced-info"></div>
|
||||
<div style="font-size: calc(var(--font-size) * 0.6);color: rgb(255, 100, 100);margin-top: 10px;text-align: center;display: none;" class="ios-warning">Only iOS 15+ is supported due to performance optimizations</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
const insertLoadingDiv = () => {
|
||||
const loadingDivElem = document.createElement('div')
|
||||
loadingDivElem.innerHTML = loadingDiv
|
||||
if (!window.pageLoaded) {
|
||||
document.documentElement.appendChild(loadingDivElem)
|
||||
}
|
||||
|
||||
// iOS version detection
|
||||
const getIOSVersion = () => {
|
||||
const match = navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/);
|
||||
return match ? parseInt(match[1], 10) : null;
|
||||
}
|
||||
|
||||
// load error handling
|
||||
const onError = (errorOrMessage, log = false) => {
|
||||
let message = errorOrMessage instanceof Error ? (errorOrMessage.stack ?? errorOrMessage.message) : errorOrMessage
|
||||
if (log) console.log(message)
|
||||
if (typeof message !== 'string') message = String(message)
|
||||
if (document.querySelector('.initial-loader') && document.querySelector('.initial-loader').querySelector('.title').textContent !== 'Error') {
|
||||
document.querySelector('.initial-loader').querySelector('.title').textContent = 'Error'
|
||||
const [errorMessage, ...errorStack] = message.split('\n')
|
||||
document.querySelector('.initial-loader').querySelector('.subtitle').textContent = errorMessage
|
||||
document.querySelector('.initial-loader').querySelector('.advanced-info').textContent = errorStack.join('\n')
|
||||
|
||||
// Show iOS warning if applicable
|
||||
const iosVersion = getIOSVersion();
|
||||
if (iosVersion !== null && iosVersion < 15) {
|
||||
document.querySelector('.initial-loader').querySelector('.ios-warning').style.display = 'block';
|
||||
}
|
||||
|
||||
if (window.navigator.maxTouchPoints > 1) window.location.hash = '#dev' // show eruda
|
||||
// unregister all sw
|
||||
if (window.navigator.serviceWorker && document.querySelector('.initial-loader').style.opacity !== 0) {
|
||||
console.log('got worker')
|
||||
window.navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
registrations.forEach(registration => {
|
||||
console.log('got registration')
|
||||
registration.unregister().then(() => {
|
||||
console.log('worker unregistered')
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
window.lastError = errorOrMessage instanceof Error ? errorOrMessage : new Error(errorOrMessage)
|
||||
}
|
||||
}
|
||||
window.addEventListener('unhandledrejection', (e) => onError(e.reason, true))
|
||||
window.addEventListener('error', (e) => onError(e.error ?? e.message))
|
||||
}
|
||||
insertLoadingDiv()
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// move loading div to the end of body
|
||||
const loadingDivElem = document.querySelector('.initial-loader');
|
||||
const newContainer = document.body; // replace with your new container
|
||||
if (loadingDivElem) newContainer.appendChild(loadingDivElem);
|
||||
})
|
||||
</script>
|
||||
<script type="module" async>
|
||||
<script type="module">
|
||||
const checkLoadEruda = () => {
|
||||
if (window.location.hash === '#dev') {
|
||||
// todo precache (check offline)?
|
||||
import('https://cdn.skypack.dev/eruda').then(({ default: eruda }) => {
|
||||
eruda.init()
|
||||
})
|
||||
Promise.all([import('https://cdn.skypack.dev/stacktrace-gps'), import('https://cdn.skypack.dev/error-stack-parser')]).then(async ([{ default: StackTraceGPS }, { default: ErrorStackParser }]) => {
|
||||
if (!window.lastError) return
|
||||
|
||||
let stackFrames = [];
|
||||
if (window.lastError instanceof Error) {
|
||||
stackFrames = ErrorStackParser.parse(window.lastError);
|
||||
}
|
||||
console.log('stackFrames', stackFrames)
|
||||
const gps = new StackTraceGPS()
|
||||
const mappedFrames = await Promise.all(
|
||||
stackFrames.map(frame => gps.pinpoint(frame))
|
||||
);
|
||||
console.log('mappedFrames', mappedFrames)
|
||||
|
||||
const stackTrace = mappedFrames
|
||||
.map(frame => `at ${frame.functionName} (${frame.fileName}:${frame.lineNumber}:${frame.columnNumber})`)
|
||||
.join('\n');
|
||||
console.log('stackTrace', stackTrace)
|
||||
})
|
||||
}
|
||||
}
|
||||
checkLoadEruda()
|
||||
|
|
@ -123,45 +20,33 @@
|
|||
})
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
html {
|
||||
background: black;
|
||||
}
|
||||
.initial-loader {
|
||||
--font-size: 20px;
|
||||
}
|
||||
@media screen and (min-width: 550px) {
|
||||
.initial-loader {
|
||||
--font-size: 30px;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 950px) {
|
||||
.initial-loader {
|
||||
--font-size: 50px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- // #endregion -->
|
||||
<!-- <script type="module">
|
||||
window.loadPluginScript = async ({ pluginName, script }) => {
|
||||
window.loadedPlugins[pluginName] = await import(script)
|
||||
}
|
||||
</script> -->
|
||||
<title>Minecraft Web Client</title>
|
||||
<!-- <link rel="canonical" href="https://mcraft.fun"> -->
|
||||
<meta name="description" content="Minecraft Java Edition Client in Browser — Full Multiplayer Support, Server Connect, Offline Play — Join real Minecraft servers">
|
||||
<meta name="keywords" content="Play, Minecraft, Online, Web, Java, Server, Single player, Javascript, PrismarineJS, Voxel, WebGL, Three.js">
|
||||
<meta name="date" content="2024-07-11" scheme="YYYY-MM-DD">
|
||||
<title>Prismarine Web Client</title>
|
||||
<link rel="stylesheet" href="index.css">
|
||||
<link rel="favicon" href="favicon.ico">
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<meta name="description" content="Minecraft web client running in your browser">
|
||||
<meta name="keywords" content="Play, Minecraft, Online, Web, Server, Single player, Javascript, PrismarineJS, Voxel, WebGL, Three.js">
|
||||
<meta name="date" content="2023-09-11" scheme="YYYY-MM-DD">
|
||||
<meta name="language" content="English">
|
||||
<meta name="author" content="PrismarineJS">
|
||||
<meta name="theme-color" content="#349474">
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover'>
|
||||
<meta property="og:title" content="Minecraft Web Client" />
|
||||
<meta property="og:title" content="Prismarine Web Client" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content="https://prismarinejs.github.io/prismarine-web-client/favicon.png" />
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
|
||||
</head>
|
||||
<body>
|
||||
<div id="react-root"></div>
|
||||
<div id="ui-root"></div>
|
||||
<div id="ui-root">
|
||||
<pmui-hud id="hud" style="display: none;"></pmui-hud>
|
||||
<pmui-pausescreen id="pause-screen" style="display: none;"></pmui-pausescreen>
|
||||
<pmui-playscreen id="play-screen" style="display: none;"></pmui-playscreen>
|
||||
<pmui-keybindsscreen id="keybinds-screen" style="display: none;"></pmui-keybindsscreen>
|
||||
<pmui-notification></pmui-notification>
|
||||
<context-menu id="context-menu"></context-menu>
|
||||
</div>
|
||||
<!-- inject script -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
188
package.json
|
|
@ -1,242 +1,130 @@
|
|||
{
|
||||
"name": "minecraft-web-client",
|
||||
"name": "prismarine-web-client",
|
||||
"version": "0.0.0-dev",
|
||||
"description": "A minecraft client running in a browser",
|
||||
"scripts": {
|
||||
"dev-rsbuild": "rsbuild dev",
|
||||
"dev-proxy": "node server.js",
|
||||
"start": "run-p dev-proxy dev-rsbuild watch-mesher",
|
||||
"start2": "run-p dev-rsbuild watch-mesher",
|
||||
"start-metrics": "ENABLE_METRICS=true rsbuild dev",
|
||||
"build": "pnpm build-other-workers && rsbuild build",
|
||||
"build-analyze": "BUNDLE_ANALYZE=true rsbuild build && pnpm build-other-workers",
|
||||
"build-single-file": "SINGLE_FILE_BUILD=true rsbuild build",
|
||||
"prepare-project": "tsx scripts/genShims.ts && tsx scripts/makeOptimizedMcData.mjs && tsx scripts/genLargeDataAliases.ts",
|
||||
"check-build": "pnpm prepare-project && tsc && pnpm build",
|
||||
"start": "node scripts/build.js copyFilesDev && node scripts/prepareData.mjs && node esbuild.mjs --watch",
|
||||
"start-watch-script": "nodemon -w esbuild.mjs esbuild.mjs",
|
||||
"build": "node scripts/build.js copyFiles && node scripts/prepareData.mjs -f && node esbuild.mjs --minify --prod",
|
||||
"check-build": "tsc && pnpm test-unit && pnpm build",
|
||||
"test:cypress": "cypress run",
|
||||
"test:benchmark": "PERFORMANCE_TEST=true cypress run",
|
||||
"test:cypress:open": "cypress open",
|
||||
"test-unit": "vitest",
|
||||
"test:e2e": "start-test http-get://localhost:8080 test:cypress",
|
||||
"prod-start": "node server.js --prod",
|
||||
"prod-start": "node server.js",
|
||||
"postinstall": "node scripts/gen-texturepack-files.mjs && tsx scripts/optimizeBlockCollisions.ts",
|
||||
"test-mc-server": "tsx cypress/minecraft-server.mjs",
|
||||
"lint": "eslint \"{src,cypress,renderer}/**/*.{ts,js,jsx,tsx}\"",
|
||||
"lint-fix": "pnpm lint --fix",
|
||||
"lint": "eslint \"{src,cypress}/**/*.{ts,js,jsx,tsx}\"",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"build-storybook": "storybook build && node scripts/build.js moveStorybookFiles",
|
||||
"start-experiments": "vite --config experiments/vite.config.ts --host",
|
||||
"watch-other-workers": "echo NOT IMPLEMENTED",
|
||||
"build-other-workers": "echo NOT IMPLEMENTED",
|
||||
"build-mesher": "node renderer/buildMesherWorker.mjs",
|
||||
"watch-mesher": "pnpm build-mesher -w",
|
||||
"run-playground": "run-p watch-mesher watch-other-workers watch-playground",
|
||||
"run-all": "run-p start run-playground",
|
||||
"build-playground": "rsbuild build --config renderer/rsbuild.config.ts",
|
||||
"watch-playground": "rsbuild dev --config renderer/rsbuild.config.ts",
|
||||
"update-git-deps": "tsx scripts/updateGitDeps.ts",
|
||||
"request-data": "tsx scripts/requestData.ts"
|
||||
"build-storybook": "storybook build",
|
||||
"start-experiments": "vite --config experiments/vite.config.ts",
|
||||
"watch-worker": "node prismarine-viewer/buildWorker.mjs -w"
|
||||
},
|
||||
"keywords": [
|
||||
"prismarine",
|
||||
"web",
|
||||
"client"
|
||||
],
|
||||
"release": {
|
||||
"attachReleaseFiles": "{self-host.zip,minecraft.html}"
|
||||
},
|
||||
"publish": {
|
||||
"preset": {
|
||||
"publishOnlyIfChanged": true,
|
||||
"runBuild": false
|
||||
}
|
||||
},
|
||||
"author": "PrismarineJS",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@dimaka/interface": "0.0.3-alpha.0",
|
||||
"@floating-ui/react": "^0.26.1",
|
||||
"@monaco-editor/react": "^4.7.0",
|
||||
"@nxg-org/mineflayer-auto-jump": "^0.7.18",
|
||||
"@nxg-org/mineflayer-tracker": "1.3.0",
|
||||
"@react-oauth/google": "^0.12.1",
|
||||
"@stylistic/eslint-plugin": "^2.6.1",
|
||||
"@types/gapi": "^0.0.47",
|
||||
"@types/react": "^18.2.20",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@types/wicg-file-system-access": "^2023.10.2",
|
||||
"@xmcl/text-component": "^2.1.3",
|
||||
"@zardoy/react-util": "^0.2.4",
|
||||
"@zardoy/react-util": "^0.2.0",
|
||||
"@zardoy/utils": "^0.0.11",
|
||||
"adm-zip": "^0.5.12",
|
||||
"browserfs": "github:zardoy/browserfs#build",
|
||||
"change-case": "^5.1.2",
|
||||
"classnames": "^2.5.1",
|
||||
"compression": "^1.7.4",
|
||||
"cors": "^2.8.5",
|
||||
"cypress-plugin-snapshots": "^1.4.4",
|
||||
"debug": "^4.3.4",
|
||||
"deepslate": "^0.23.5",
|
||||
"diff-match-patch": "^1.0.5",
|
||||
"eruda": "^3.0.1",
|
||||
"esbuild": "^0.19.3",
|
||||
"esbuild-plugin-polyfill-node": "^0.3.0",
|
||||
"express": "^4.18.2",
|
||||
"filesize": "^10.0.12",
|
||||
"flying-squid": "npm:@zardoy/flying-squid@^0.0.104",
|
||||
"framer-motion": "^12.9.2",
|
||||
"flying-squid": "github:zardoy/space-squid#everything",
|
||||
"fs-extra": "^11.1.1",
|
||||
"google-drive-browserfs": "github:zardoy/browserfs#google-drive",
|
||||
"iconify-icon": "^1.0.8",
|
||||
"jszip": "^3.10.1",
|
||||
"lit": "^2.8.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mcraft-fun-mineflayer": "^0.1.23",
|
||||
"minecraft-data": "3.98.0",
|
||||
"minecraft-protocol": "github:PrismarineJS/node-minecraft-protocol#master",
|
||||
"mineflayer-item-map-downloader": "github:zardoy/mineflayer-item-map-downloader",
|
||||
"mojangson": "^2.0.4",
|
||||
"minecraft-assets": "^1.9.1",
|
||||
"minecraft-data": "3.48.0",
|
||||
"net-browserify": "github:zardoy/prismarinejs-net-browserify",
|
||||
"node-gzip": "^1.1.2",
|
||||
"peerjs": "^1.5.0",
|
||||
"pixelarticons": "^1.8.1",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"prismarine-provider-anvil": "github:zardoy/prismarine-provider-anvil#everything",
|
||||
"prosemirror-example-setup": "^1.2.2",
|
||||
"prosemirror-markdown": "^1.12.0",
|
||||
"prosemirror-menu": "^1.2.4",
|
||||
"prosemirror-state": "^1.4.3",
|
||||
"prosemirror-view": "^1.33.1",
|
||||
"qrcode.react": "^3.1.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-select": "^5.8.0",
|
||||
"react-zoom-pan-pinch": "3.4.4",
|
||||
"remark": "^15.0.1",
|
||||
"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",
|
||||
"use-typed-event-listener": "^4.0.2",
|
||||
"valtio": "^1.11.1",
|
||||
"vec3": "^0.1.7",
|
||||
"wait-on": "^7.2.0",
|
||||
"workbox-build": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rsbuild/core": "1.3.5",
|
||||
"@rsbuild/plugin-node-polyfill": "1.3.0",
|
||||
"@rsbuild/plugin-react": "1.2.0",
|
||||
"@rsbuild/plugin-type-check": "1.2.1",
|
||||
"@rsbuild/plugin-typed-css-modules": "1.0.2",
|
||||
"@storybook/addon-essentials": "^7.4.6",
|
||||
"@storybook/addon-links": "^7.4.6",
|
||||
"@storybook/blocks": "^7.4.6",
|
||||
"@storybook/react": "^7.4.6",
|
||||
"@storybook/react-vite": "^7.4.6",
|
||||
"@types/diff-match-patch": "^1.0.36",
|
||||
"@storybook/web-components": "^7.4.6",
|
||||
"@storybook/web-components-vite": "^7.4.6",
|
||||
"@types/lodash-es": "^4.17.9",
|
||||
"@types/react-transition-group": "^4.4.7",
|
||||
"@types/stats.js": "^0.17.1",
|
||||
"@types/three": "0.154.0",
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
"@types/wait-on": "^5.3.4",
|
||||
"@types/three": "0.128.0",
|
||||
"@xmcl/installer": "^5.1.0",
|
||||
"assert": "^2.0.0",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
"constants-browserify": "^1.0.0",
|
||||
"contro-max": "^0.1.9",
|
||||
"contro-max": "^0.1.1",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"cypress": "^9.5.4",
|
||||
"cypress-esbuild-preprocessor": "^1.0.2",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-config-zardoy": "^0.2.17",
|
||||
"events": "^3.3.0",
|
||||
"gzip-size": "^7.0.0",
|
||||
"filesize": "^10.0.12",
|
||||
"http-browserify": "^1.7.0",
|
||||
"http-server": "^14.1.1",
|
||||
"https-browserify": "^1.0.0",
|
||||
"mc-assets": "^0.2.62",
|
||||
"minecraft-inventory-gui": "github:zardoy/minecraft-inventory-gui#next",
|
||||
"mineflayer": "github:zardoy/mineflayer#gen-the-master",
|
||||
"mineflayer-mouse": "^0.1.21",
|
||||
"mineflayer": "github:zardoy/mineflayer#custom",
|
||||
"mineflayer-pathfinder": "^2.4.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"path-exists-cli": "^2.0.0",
|
||||
"prismarine-viewer": "link:prismarine-viewer",
|
||||
"process": "github:PrismarineJS/node-process",
|
||||
"renderer": "link:renderer",
|
||||
"rimraf": "^5.0.1",
|
||||
"storybook": "^7.4.6",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"three": "0.154.0",
|
||||
"three": "0.128.0",
|
||||
"timers-browserify": "^2.0.12",
|
||||
"typescript": "5.5.4",
|
||||
"typescript": "^5.2.2",
|
||||
"use-typed-event-listener": "^4.0.2",
|
||||
"vitest": "^0.34.6",
|
||||
"yaml": "^2.3.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"cypress": "^10.11.0",
|
||||
"cypress-plugin-snapshots": "^1.4.4",
|
||||
"sharp": "^0.33.5",
|
||||
"systeminformation": "^5.21.22"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
"iOS >= 14",
|
||||
"Android >= 13",
|
||||
"Chrome >= 103",
|
||||
"not dead",
|
||||
"not ie <= 11",
|
||||
"not op_mini all",
|
||||
"> 0.5%"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"mineflayer": "github:zardoy/mineflayer#gen-the-master",
|
||||
"@nxg-org/mineflayer-physics-util": "1.8.10",
|
||||
"buffer": "^6.0.3",
|
||||
"vec3": "0.1.10",
|
||||
"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.98.0",
|
||||
"minecraft-data": "3.48.0",
|
||||
"prismarine-provider-anvil": "github:zardoy/prismarine-provider-anvil#everything",
|
||||
"prismarine-physics": "github:zardoy/prismarine-physics",
|
||||
"minecraft-protocol": "github:PrismarineJS/node-minecraft-protocol#master",
|
||||
"react": "^18.2.0",
|
||||
"prismarine-chunk": "github:zardoy/prismarine-chunk#master",
|
||||
"prismarine-item": "latest"
|
||||
},
|
||||
"updateConfig": {
|
||||
"ignoreDependencies": [
|
||||
"browserfs",
|
||||
"google-drive-browserfs"
|
||||
]
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"pixelarticons@1.8.1": "patches/pixelarticons@1.8.1.patch",
|
||||
"mineflayer-item-map-downloader@1.2.0": "patches/mineflayer-item-map-downloader@1.2.0.patch",
|
||||
"minecraft-protocol": "patches/minecraft-protocol.patch"
|
||||
},
|
||||
"ignoredBuiltDependencies": [
|
||||
"canvas",
|
||||
"core-js",
|
||||
"gl"
|
||||
],
|
||||
"onlyBuiltDependencies": [
|
||||
"sharp",
|
||||
"cypress",
|
||||
"esbuild",
|
||||
"fsevents"
|
||||
],
|
||||
"ignorePatchFailures": false,
|
||||
"allowUnusedPatches": false
|
||||
},
|
||||
"packageManager": "pnpm@10.8.0+sha512.0e82714d1b5b43c74610193cb20734897c1d00de89d0e18420aebc5977fa13d780a9cb05734624e81ebd81cc876cd464794850641c48b9544326b5622ca29971"
|
||||
"minecraft-protocol": "github:zardoy/minecraft-protocol#custom-client-extra",
|
||||
"react": "^18.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"name": "minecraft-react",
|
||||
"description": "A Minecraft-like React UI library",
|
||||
"keywords": [
|
||||
"minecraft",
|
||||
"minecraft style",
|
||||
"minecraft ui",
|
||||
"minecraft components",
|
||||
"minecraft react",
|
||||
"minecraft library",
|
||||
"minecraft web",
|
||||
"minecraft browser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"**"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"default": "./dist/react/npmReactComponents.js",
|
||||
"types": "./dist/react/npmReactComponents.d.ts"
|
||||
},
|
||||
"./*": {
|
||||
"default": "./dist/react/*",
|
||||
"types": "./dist/react/*"
|
||||
},
|
||||
"./dist": {
|
||||
"default": "./dist/*",
|
||||
"types": "./dist/*"
|
||||
}
|
||||
},
|
||||
"module": "./dist/react/npmReactComponents.js",
|
||||
"types": "./dist/react/npmReactComponents.d.ts",
|
||||
"repository": "zardoy/minecraft-web-client",
|
||||
"version": "0.0.0-dev",
|
||||
"dependencies": {},
|
||||
"peerDependencies": {
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
diff --git a/src/client/chat.js b/src/client/chat.js
|
||||
index 0021870994fc59a82f0ac8aba0a65a8be43ef2f4..a53fceb843105ea2a1d88722b3fc7c3b43cb102a 100644
|
||||
--- a/src/client/chat.js
|
||||
+++ b/src/client/chat.js
|
||||
@@ -116,7 +116,7 @@ module.exports = function (client, options) {
|
||||
for (const player of packet.data) {
|
||||
if (player.chatSession) {
|
||||
client._players[player.uuid] = {
|
||||
- publicKey: crypto.createPublicKey({ key: player.chatSession.publicKey.keyBytes, format: 'der', type: 'spki' }),
|
||||
+ // publicKey: crypto.createPublicKey({ key: player.chatSession.publicKey.keyBytes, format: 'der', type: 'spki' }),
|
||||
publicKeyDER: player.chatSession.publicKey.keyBytes,
|
||||
sessionUuid: player.chatSession.uuid
|
||||
}
|
||||
@@ -126,7 +126,7 @@ module.exports = function (client, options) {
|
||||
|
||||
if (player.crypto) {
|
||||
client._players[player.uuid] = {
|
||||
- publicKey: crypto.createPublicKey({ key: player.crypto.publicKey, format: 'der', type: 'spki' }),
|
||||
+ // publicKey: crypto.createPublicKey({ key: player.crypto.publicKey, format: 'der', type: 'spki' }),
|
||||
publicKeyDER: player.crypto.publicKey,
|
||||
signature: player.crypto.signature,
|
||||
displayName: player.displayName || player.name
|
||||
@@ -196,7 +196,7 @@ module.exports = function (client, options) {
|
||||
if (mcData.supportFeature('useChatSessions')) {
|
||||
const tsDelta = BigInt(Date.now()) - packet.timestamp
|
||||
const expired = !packet.timestamp || tsDelta > messageExpireTime || tsDelta < 0
|
||||
- const verified = !packet.unsignedChatContent && updateAndValidateSession(packet.senderUuid, packet.plainMessage, packet.signature, packet.index, packet.previousMessages, packet.salt, packet.timestamp) && !expired
|
||||
+ const verified = false && !packet.unsignedChatContent && updateAndValidateSession(packet.senderUuid, packet.plainMessage, packet.signature, packet.index, packet.previousMessages, packet.salt, packet.timestamp) && !expired
|
||||
if (verified) client._signatureCache.push(packet.signature)
|
||||
client.emit('playerChat', {
|
||||
globalIndex: packet.globalIndex,
|
||||
@@ -362,7 +362,7 @@ module.exports = function (client, options) {
|
||||
}
|
||||
}
|
||||
|
||||
- client._signedChat = (message, options = {}) => {
|
||||
+ client._signedChat = async (message, options = {}) => {
|
||||
options.timestamp = options.timestamp || BigInt(Date.now())
|
||||
options.salt = options.salt || 1n
|
||||
|
||||
@@ -407,7 +407,7 @@ module.exports = function (client, options) {
|
||||
message,
|
||||
timestamp: options.timestamp,
|
||||
salt: options.salt,
|
||||
- signature: (client.profileKeys && client._session) ? client.signMessage(message, options.timestamp, options.salt, undefined, acknowledgements) : undefined,
|
||||
+ signature: (client.profileKeys && client._session) ? await client.signMessage(message, options.timestamp, options.salt, undefined, acknowledgements) : undefined,
|
||||
offset: client._lastSeenMessages.pending,
|
||||
checksum: computeChatChecksum(client._lastSeenMessages), // 1.21.5+
|
||||
acknowledged
|
||||
@@ -422,7 +422,7 @@ module.exports = function (client, options) {
|
||||
message,
|
||||
timestamp: options.timestamp,
|
||||
salt: options.salt,
|
||||
- signature: client.profileKeys ? client.signMessage(message, options.timestamp, options.salt, options.preview) : Buffer.alloc(0),
|
||||
+ signature: client.profileKeys ? await client.signMessage(message, options.timestamp, options.salt, options.preview) : Buffer.alloc(0),
|
||||
signedPreview: options.didPreview,
|
||||
previousMessages: client._lastSeenMessages.map((e) => ({
|
||||
messageSender: e.sender,
|
||||
diff --git a/src/client/encrypt.js b/src/client/encrypt.js
|
||||
index 63cc2bd9615100bd2fd63dfe14c094aa6b8cd1c9..36df57d1196af9761d920fa285ac48f85410eaef 100644
|
||||
--- a/src/client/encrypt.js
|
||||
+++ b/src/client/encrypt.js
|
||||
@@ -25,7 +25,11 @@ module.exports = function (client, options) {
|
||||
if (packet.serverId !== '-') {
|
||||
debug('This server appears to be an online server and you are providing no password, the authentication will probably fail')
|
||||
}
|
||||
- sendEncryptionKeyResponse()
|
||||
+ client.end('This server appears to be an online server and you are providing no authentication. Try authenticating first.')
|
||||
+ // sendEncryptionKeyResponse()
|
||||
+ // client.once('set_compression', () => {
|
||||
+ // clearTimeout(loginTimeout)
|
||||
+ // })
|
||||
}
|
||||
|
||||
function onJoinServerResponse (err) {
|
||||
diff --git a/src/client/pluginChannels.js b/src/client/pluginChannels.js
|
||||
index 671eb452f31e6b5fcd57d715f1009d010160c65f..7f69f511c8fb97d431ec5125c851b49be8e2ab76 100644
|
||||
--- a/src/client/pluginChannels.js
|
||||
+++ b/src/client/pluginChannels.js
|
||||
@@ -57,7 +57,7 @@ module.exports = function (client, options) {
|
||||
try {
|
||||
packet.data = proto.parsePacketBuffer(channel, packet.data).data
|
||||
} catch (error) {
|
||||
- client.emit('error', error)
|
||||
+ client.emit('error', error, { customPayload: packet })
|
||||
return
|
||||
}
|
||||
}
|
||||
diff --git a/src/client.js b/src/client.js
|
||||
index e369e77d055ba919e8f9da7b8e8b5dc879c74cf4..54bb9e6644388e9b6bd42b3012951875989cdf0c 100644
|
||||
--- a/src/client.js
|
||||
+++ b/src/client.js
|
||||
@@ -111,7 +111,13 @@ class Client extends EventEmitter {
|
||||
this._hasBundlePacket = false
|
||||
}
|
||||
} else {
|
||||
- emitPacket(parsed)
|
||||
+ try {
|
||||
+ emitPacket(parsed)
|
||||
+ } catch (err) {
|
||||
+ console.log('Client incorrectly handled packet ' + parsed.metadata.name)
|
||||
+ console.error(err)
|
||||
+ // todo investigate why it doesn't close the stream even if unhandled there
|
||||
+ }
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -169,7 +175,10 @@ class Client extends EventEmitter {
|
||||
}
|
||||
|
||||
const onFatalError = (err) => {
|
||||
- this.emit('error', err)
|
||||
+ // todo find out what is trying to write after client disconnect
|
||||
+ if(err.code !== 'ECONNABORTED') {
|
||||
+ this.emit('error', err)
|
||||
+ }
|
||||
endSocket()
|
||||
}
|
||||
|
||||
@@ -198,6 +207,10 @@ class Client extends EventEmitter {
|
||||
serializer -> framer -> socket -> splitter -> deserializer */
|
||||
if (this.serializer) {
|
||||
this.serializer.end()
|
||||
+ setTimeout(() => {
|
||||
+ this.socket?.end()
|
||||
+ this.socket?.emit('end')
|
||||
+ }, 2000) // allow the serializer to finish writing
|
||||
} else {
|
||||
if (this.socket) this.socket.end()
|
||||
}
|
||||
@@ -243,6 +256,7 @@ class Client extends EventEmitter {
|
||||
debug('writing packet ' + this.state + '.' + name)
|
||||
debug(params)
|
||||
}
|
||||
+ this.emit('writePacket', name, params)
|
||||
this.serializer.write({ name, params })
|
||||
}
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
diff --git a/package.json b/package.json
|
||||
index 2a7aff75a9f1c7fe4eebb657002e58f4581dad0e..cd3490983353336efeb13f24f0af69c6c1d16444 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -9,10 +9,7 @@
|
||||
"keywords": [],
|
||||
"author": "Ic3Tank",
|
||||
"license": "ISC",
|
||||
- "dependencies": {
|
||||
- "mineflayer": "^4.3.0",
|
||||
- "sharp": "^0.30.6"
|
||||
- },
|
||||
+ "dependencies": {},
|
||||
"devDependencies": {
|
||||
"mineflayer-item-map-downloader": "file:./"
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
diff --git a/fonts/pixelart-icons-font.css b/fonts/pixelart-icons-font.css
|
||||
index 3b2ebe839370d96bf93ef5ca94a827f07e49378d..4f8d76be2ca6e4ddc43c68d0a6f0f69979165ab4 100644
|
||||
--- a/fonts/pixelart-icons-font.css
|
||||
+++ b/fonts/pixelart-icons-font.css
|
||||
@@ -1,16 +1,13 @@
|
||||
@font-face {
|
||||
font-family: "pixelart-icons-font";
|
||||
- src: url('pixelart-icons-font.eot?t=1711815892278'); /* IE9*/
|
||||
- src: url('pixelart-icons-font.eot?t=1711815892278#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
+ src:
|
||||
url("pixelart-icons-font.woff2?t=1711815892278") format("woff2"),
|
||||
url("pixelart-icons-font.woff?t=1711815892278") format("woff"),
|
||||
- url('pixelart-icons-font.ttf?t=1711815892278') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
- url('pixelart-icons-font.svg?t=1711815892278#pixelart-icons-font') format('svg'); /* iOS 4.1- */
|
||||
+ url('pixelart-icons-font.ttf?t=1711815892278') format('truetype'); /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
}
|
||||
|
||||
[class^="pixelart-icons-font-"], [class*=" pixelart-icons-font-"] {
|
||||
font-family: 'pixelart-icons-font' !important;
|
||||
- font-size:24px;
|
||||
font-style:normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
@@ -503,4 +500,3 @@
|
||||
.pixelart-icons-font-zap:before { content: "\ebe4"; }
|
||||
.pixelart-icons-font-zoom-in:before { content: "\ebe5"; }
|
||||
.pixelart-icons-font-zoom-out:before { content: "\ebe6"; }
|
||||
-
|
||||