From d1d47b334c7525c9083a2a3b39797fef368c914a Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Mon, 6 May 2024 01:04:04 +0300 Subject: [PATCH 1/4] fix camera desync issues --- prismarine-viewer/viewer/lib/viewer.ts | 8 +++++++- prismarine-viewer/viewer/lib/worldrendererCommon.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/prismarine-viewer/viewer/lib/viewer.ts b/prismarine-viewer/viewer/lib/viewer.ts index 9cb7eb3d..9f8067db 100644 --- a/prismarine-viewer/viewer/lib/viewer.ts +++ b/prismarine-viewer/viewer/lib/viewer.ts @@ -12,7 +12,6 @@ export class Viewer { scene: THREE.Scene ambientLight: THREE.AmbientLight directionalLight: THREE.DirectionalLight - camera: THREE.PerspectiveCamera world: WorldRendererCommon entities: Entities // primitives: Primitives @@ -25,6 +24,13 @@ export class Viewer { renderingUntilNoUpdates = false processEntityOverrides = (e, overrides) => overrides + get camera () { + return this.world.camera + } + set camera (camera) { + this.world.camera = camera + } + constructor(public renderer: THREE.WebGLRenderer, worldConfig = defaultWorldRendererConfig) { // https://discourse.threejs.org/t/updates-to-color-management-in-three-js-r152/50791 THREE.ColorManagement.enabled = false diff --git a/prismarine-viewer/viewer/lib/worldrendererCommon.ts b/prismarine-viewer/viewer/lib/worldrendererCommon.ts index 43983977..05fb6f4e 100644 --- a/prismarine-viewer/viewer/lib/worldrendererCommon.ts +++ b/prismarine-viewer/viewer/lib/worldrendererCommon.ts @@ -54,6 +54,7 @@ export abstract class WorldRendererCommon allChunksFinished = false handleResize = () => { } mesherConfig = defaultMesherConfig + camera: THREE.PerspectiveCamera abstract outputFormat: 'threeJs' | 'webgl' From 36962331d17bdcd65951f00e6383b6eb60662c2e Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Mon, 6 May 2024 01:54:29 +0300 Subject: [PATCH 2/4] chore: up mc-data, fix cam reset fix: hide add server UI after adding a server --- package.json | 4 +- pnpm-lock.yaml | 60 +++++++++---------- prismarine-viewer/viewer/lib/mesher/models.ts | 4 +- .../viewer/lib/mesher/test/mesherTester.ts | 15 +++-- prismarine-viewer/viewer/lib/viewer.ts | 4 +- .../viewer/lib/worldrendererThree.ts | 2 +- src/react/ServersListProvider.tsx | 9 +-- 7 files changed, 51 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 25a87472..fdaecb65 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "jszip": "^3.10.1", "lodash-es": "^4.17.21", "minecraft-assets": "^1.12.2", - "minecraft-data": "3.62.0", + "minecraft-data": "3.65.0", "net-browserify": "github:zardoy/prismarinejs-net-browserify", "node-gzip": "^1.1.2", "peerjs": "^1.5.0", @@ -154,7 +154,7 @@ "diamond-square": "github:zardoy/diamond-square", "prismarine-block": "github:zardoy/prismarine-block#next-era", "prismarine-world": "github:zardoy/prismarine-world#next-era", - "minecraft-data": "3.62.0", + "minecraft-data": "3.65.0", "prismarine-provider-anvil": "github:zardoy/prismarine-provider-anvil#everything", "minecraft-protocol": "github:zardoy/minecraft-protocol#everything", "react": "^18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 054539d5..21d48b30 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ overrides: diamond-square: github:zardoy/diamond-square prismarine-block: github:zardoy/prismarine-block#next-era prismarine-world: github:zardoy/prismarine-world#next-era - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 prismarine-provider-anvil: github:zardoy/prismarine-provider-anvil#everything minecraft-protocol: github:zardoy/minecraft-protocol#everything react: ^18.2.0 @@ -120,8 +120,8 @@ importers: specifier: ^1.12.2 version: 1.12.2 minecraft-data: - specifier: 3.62.0 - version: 3.62.0 + specifier: 3.65.0 + version: 3.65.0 mojangson: specifier: ^2.0.4 version: 2.0.4 @@ -139,7 +139,7 @@ importers: version: 6.1.1 prismarine-provider-anvil: specifier: github:zardoy/prismarine-provider-anvil#everything - version: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/02d81b0eba6ab1c362862970954f9a3c150c9a29(minecraft-data@3.62.0) + version: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/02d81b0eba6ab1c362862970954f9a3c150c9a29(minecraft-data@3.65.0) prosemirror-example-setup: specifier: ^1.2.2 version: 1.2.2 @@ -375,7 +375,7 @@ importers: version: https://codeload.github.com/zardoy/prismarine-block/tar.gz/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-chunk: specifier: github:zardoy/prismarine-chunk - version: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.62.0) + version: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.65.0) prismarine-schematic: specifier: ^1.2.0 version: 1.2.3 @@ -6028,8 +6028,8 @@ packages: minecraft-assets@1.12.2: resolution: {integrity: sha512-/eMxh3LNjCXOnU6KnQMjBM8dRnoJNpWIg7mD2m2RthraYiQK2FNzPWIKxWm2j3Ufcf5nzFXupgABledE86r4fQ==} - minecraft-data@3.62.0: - resolution: {integrity: sha512-jJXZ/WgyX79tIHlqvfyqG+sJDUekHiA3e9NRUCMGUno4NDrZMcpRI065DnkrI720RHTMb8iadf0NmnBP4Rla5A==} + minecraft-data@3.65.0: + resolution: {integrity: sha512-9K8dOrdrcpUklTdqKBtRcKur0gLZnguTvhM/1Xv52qzh8Unkto4290RJc4ueRIYo1VqN4zzQrRxO8lnqtkERDQ==} minecraft-folder-path@1.2.0: resolution: {integrity: sha512-qaUSbKWoOsH9brn0JQuBhxNAzTDMwrOXorwuRxdJKKKDYvZhtml+6GVCUrY5HRiEsieBEjCUnhVpDuQiKsiFaw==} @@ -6691,7 +6691,7 @@ packages: prismarine-biome@1.3.0: resolution: {integrity: sha512-GY6nZxq93mTErT7jD7jt8YS1aPrOakbJHh39seYsJFXvueIOdHAmW16kYQVrTVMW5MlWLQVxV/EquRwOgr4MnQ==} peerDependencies: - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 prismarine-registry: ^1.1.0 prismarine-block@https://codeload.github.com/zardoy/prismarine-block/tar.gz/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0: @@ -11923,16 +11923,16 @@ snapshots: exit-hook: 2.2.1 flatmap: 0.0.3 long: 5.2.3 - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 minecraft-protocol: https://codeload.github.com/zardoy/minecraft-protocol/tar.gz/2c14a686bfe7cbd9a5c87b629b402295ee86219f(encoding@0.1.13) mkdirp: 2.1.6 node-gzip: 1.1.2 node-rsa: 1.1.1 - prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.62.0) + prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.65.0) prismarine-entity: 2.3.1 prismarine-item: 1.14.0 prismarine-nbt: 2.5.0 - prismarine-provider-anvil: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/02d81b0eba6ab1c362862970954f9a3c150c9a29(minecraft-data@3.62.0) + prismarine-provider-anvil: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/02d81b0eba6ab1c362862970954f9a3c150c9a29(minecraft-data@3.65.0) prismarine-windows: 2.9.0 prismarine-world: https://codeload.github.com/zardoy/prismarine-world/tar.gz/6ae6f009d38460de284f8c226c665f04cbad9465 rambda: 9.2.0 @@ -13194,8 +13194,8 @@ snapshots: diamond-square@https://codeload.github.com/zardoy/diamond-square/tar.gz/915fce8e27fe8eb45464d89b9563956afa4f7687: dependencies: - minecraft-data: 3.62.0 - prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.62.0) + minecraft-data: 3.65.0 + prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.65.0) random-seed: 0.3.0 vec3: 0.1.8 @@ -15659,7 +15659,7 @@ snapshots: minecraft-assets@1.12.2: {} - minecraft-data@3.62.0: {} + minecraft-data@3.65.0: {} minecraft-folder-path@1.2.0: {} @@ -15679,7 +15679,7 @@ snapshots: endian-toggle: 0.0.0 lodash.get: 4.4.2 lodash.merge: 4.6.2 - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 minecraft-folder-path: 1.2.0 node-fetch: 2.7.0(encoding@0.1.13) node-rsa: 0.4.2 @@ -15719,7 +15719,7 @@ snapshots: mineflayer-pathfinder@2.4.4: dependencies: - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 prismarine-block: https://codeload.github.com/zardoy/prismarine-block/tar.gz/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-entity: 2.3.1 prismarine-item: 1.14.0 @@ -15729,12 +15729,12 @@ snapshots: mineflayer@https://codeload.github.com/PrismarineJS/mineflayer/tar.gz/5a544cf2547a6e0f1f17786962d77a33c661c02f(encoding@0.1.13): dependencies: - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 minecraft-protocol: https://codeload.github.com/zardoy/minecraft-protocol/tar.gz/2c14a686bfe7cbd9a5c87b629b402295ee86219f(encoding@0.1.13) - prismarine-biome: 1.3.0(minecraft-data@3.62.0)(prismarine-registry@1.7.0) + prismarine-biome: 1.3.0(minecraft-data@3.65.0)(prismarine-registry@1.7.0) prismarine-block: https://codeload.github.com/zardoy/prismarine-block/tar.gz/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-chat: 1.9.1 - prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.62.0) + prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.65.0) prismarine-entity: 2.3.1 prismarine-item: 1.14.0 prismarine-nbt: 2.5.0 @@ -16431,15 +16431,15 @@ snapshots: - encoding - supports-color - prismarine-biome@1.3.0(minecraft-data@3.62.0)(prismarine-registry@1.7.0): + prismarine-biome@1.3.0(minecraft-data@3.65.0)(prismarine-registry@1.7.0): dependencies: - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 prismarine-registry: 1.7.0 prismarine-block@https://codeload.github.com/zardoy/prismarine-block/tar.gz/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0: dependencies: - minecraft-data: 3.62.0 - prismarine-biome: 1.3.0(minecraft-data@3.62.0)(prismarine-registry@1.7.0) + minecraft-data: 3.65.0 + prismarine-biome: 1.3.0(minecraft-data@3.65.0)(prismarine-registry@1.7.0) prismarine-chat: 1.9.1 prismarine-item: 1.14.0 prismarine-nbt: 2.5.0 @@ -16452,9 +16452,9 @@ snapshots: prismarine-nbt: 2.5.0 prismarine-registry: 1.7.0 - prismarine-chunk@https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.62.0): + prismarine-chunk@https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.65.0): dependencies: - prismarine-biome: 1.3.0(minecraft-data@3.62.0)(prismarine-registry@1.7.0) + prismarine-biome: 1.3.0(minecraft-data@3.65.0)(prismarine-registry@1.7.0) prismarine-block: https://codeload.github.com/zardoy/prismarine-block/tar.gz/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-nbt: 2.5.0 prismarine-registry: 1.7.0 @@ -16487,13 +16487,13 @@ snapshots: prismarine-physics@1.8.0: dependencies: - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 prismarine-nbt: 2.5.0 vec3: 0.1.8 - prismarine-provider-anvil@https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/02d81b0eba6ab1c362862970954f9a3c150c9a29(minecraft-data@3.62.0): + prismarine-provider-anvil@https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/02d81b0eba6ab1c362862970954f9a3c150c9a29(minecraft-data@3.65.0): dependencies: - prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.62.0) + prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/f32234a724a5c2482ffbaf85edc5e91c7ab9b38f(minecraft-data@3.65.0) prismarine-nbt: 2.5.0 uint4: 0.1.2 vec3: 0.1.8 @@ -16514,12 +16514,12 @@ snapshots: prismarine-registry@1.7.0: dependencies: - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 prismarine-nbt: 2.5.0 prismarine-schematic@1.2.3: dependencies: - minecraft-data: 3.62.0 + minecraft-data: 3.65.0 prismarine-block: https://codeload.github.com/zardoy/prismarine-block/tar.gz/ada4ec3fdfbbc1cc20ab01d0e23f0718a77cc1a0 prismarine-nbt: 2.2.1 prismarine-world: https://codeload.github.com/zardoy/prismarine-world/tar.gz/6ae6f009d38460de284f8c226c665f04cbad9465 diff --git a/prismarine-viewer/viewer/lib/mesher/models.ts b/prismarine-viewer/viewer/lib/mesher/models.ts index 833de180..bfb96d11 100644 --- a/prismarine-viewer/viewer/lib/mesher/models.ts +++ b/prismarine-viewer/viewer/lib/mesher/models.ts @@ -349,8 +349,7 @@ function renderElement (world: World, cursor: Vec3, element, doAO: boolean, attr const aos: number[] = [] const neighborPos = position.plus(new Vec3(...dir)) - let baseLightLevel = world.getLight(neighborPos) - const baseLight = baseLightLevel / 15 + const baseLight = world.getLight(neighborPos) / 15 for (const pos of corners) { let vertex = [ (pos[0] ? maxx : minx), @@ -418,6 +417,7 @@ function renderElement (world: World, cursor: Vec3, element, doAO: boolean, attr attr.tiles[`${cursor.x},${cursor.y},${cursor.z}`].faces.push({ face, neighbor: `${neighborPos.x},${neighborPos.y},${neighborPos.z}`, + light: baseLight // texture: eFace.texture.name, }) } diff --git a/prismarine-viewer/viewer/lib/mesher/test/mesherTester.ts b/prismarine-viewer/viewer/lib/mesher/test/mesherTester.ts index 21c5d129..a665db6b 100644 --- a/prismarine-viewer/viewer/lib/mesher/test/mesherTester.ts +++ b/prismarine-viewer/viewer/lib/mesher/test/mesherTester.ts @@ -1,6 +1,6 @@ import { setBlockStatesData, getSectionGeometry } from '../models' import { World as MesherWorld } from '../world' -import ChunkLoader from 'prismarine-chunk' +import ChunkLoader, { PCChunk } from 'prismarine-chunk' import { Vec3 } from 'vec3' import MinecraftData from 'minecraft-data' @@ -26,18 +26,25 @@ export const setup = (version, initialBlocks: [number[], string][]) => { return { centerFaces, totalTiles, - centerTileNeighbors + centerTileNeighbors, + faces: sectionGeometry.tiles[`${pos.x},${pos.y},${pos.z}`]?.faces ?? [] } } setBlockStatesData(blockStates, true) - mesherWorld.addColumn(0, 0, chunk1.toJson()) + const reload = () => { + mesherWorld.removeColumn(0, 0) + mesherWorld.addColumn(0, 0, chunk1.toJson()) + } + reload() return { mesherWorld, getGeometry, pos, - mcData + mcData, + reload, + chunk: chunk1 as PCChunk } } diff --git a/prismarine-viewer/viewer/lib/viewer.ts b/prismarine-viewer/viewer/lib/viewer.ts index 9f8067db..65091f3e 100644 --- a/prismarine-viewer/viewer/lib/viewer.ts +++ b/prismarine-viewer/viewer/lib/viewer.ts @@ -38,9 +38,9 @@ export class Viewer { this.scene = new THREE.Scene() this.scene.matrixAutoUpdate = false // for perf - this.resetScene() - this.threeJsWorld = new WorldRendererThree(this.scene, this.renderer, this.camera, worldConfig) + this.threeJsWorld = new WorldRendererThree(this.scene, this.renderer, worldConfig) this.setWorld() + this.resetScene() this.entities = new Entities(this.scene) // this.primitives = new Primitives(this.scene, this.camera) diff --git a/prismarine-viewer/viewer/lib/worldrendererThree.ts b/prismarine-viewer/viewer/lib/worldrendererThree.ts index 1fff112f..a099dbbc 100644 --- a/prismarine-viewer/viewer/lib/worldrendererThree.ts +++ b/prismarine-viewer/viewer/lib/worldrendererThree.ts @@ -20,7 +20,7 @@ export class WorldRendererThree extends WorldRendererCommon { return Object.values(this.sectionObjects).reduce((acc, obj) => acc + (obj as any).tilesCount, 0) } - constructor(public scene: THREE.Scene, public renderer: THREE.WebGLRenderer, public camera: THREE.PerspectiveCamera, public config: WorldRendererConfig) { + constructor(public scene: THREE.Scene, public renderer: THREE.WebGLRenderer, public config: WorldRendererConfig) { super(config) } diff --git a/src/react/ServersListProvider.tsx b/src/react/ServersListProvider.tsx index 85c55ed6..5da2fc68 100644 --- a/src/react/ServersListProvider.tsx +++ b/src/react/ServersListProvider.tsx @@ -180,16 +180,13 @@ const Inner = () => { const isEditScreenModal = useIsModalActive('editServer') - useEffect(() => { - if (!isEditScreenModal) { - setServerEditScreen(null) - } - }, [isEditScreenModal]) - useEffect(() => { if (serverEditScreen && !isEditScreenModal) { showModal({ reactType: 'editServer' }) } + if (!serverEditScreen && isEditScreenModal) { + hideCurrentModal() + } }, [serverEditScreen]) if (isEditScreenModal) { From 03b3e56a74eb8c375b67209b88892bea35292378 Mon Sep 17 00:00:00 2001 From: Vitaly Date: Mon, 6 May 2024 19:06:44 +0300 Subject: [PATCH 3/4] fix: reload the page on quit button until issues with time desync are fixed up squid to restore support for 1.14 worlds --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- src/flyingSquidUtils.ts | 1 + src/react/AppStatus.tsx | 2 +- src/react/PauseScreen.tsx | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index fdaecb65..acee3c83 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "esbuild": "^0.19.3", "esbuild-plugin-polyfill-node": "^0.3.0", "express": "^4.18.2", - "flying-squid": "npm:@zardoy/flying-squid@^0.0.19", + "flying-squid": "npm:@zardoy/flying-squid@^0.0.20", "fs-extra": "^11.1.1", "google-drive-browserfs": "github:zardoy/browserfs#google-drive", "iconify-icon": "^1.0.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 21d48b30..36cc8e30 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,8 +99,8 @@ importers: specifier: ^10.0.12 version: 10.0.12 flying-squid: - specifier: npm:@zardoy/flying-squid@^0.0.19 - version: '@zardoy/flying-squid@0.0.19(encoding@0.1.13)' + specifier: npm:@zardoy/flying-squid@^0.0.20 + version: '@zardoy/flying-squid@0.0.20(encoding@0.1.13)' fs-extra: specifier: ^11.1.1 version: 11.1.1 @@ -3043,8 +3043,8 @@ packages: resolution: {integrity: sha512-6xm38yGVIa6mKm/DUCF2zFFJhERh/QWp1ufm4cNUvxsONBmfPg8uZ9pZBdOmF6qFGr/HlT6ABBkCSx/dlEtvWg==} engines: {node: '>=12 <14 || 14.2 - 14.9 || >14.10.0'} - '@zardoy/flying-squid@0.0.19': - resolution: {integrity: sha512-q0eW/AO66bA5YQfGd+mnZjenZ7oocCrxlU4ktJbS4vfhjC2PPLzXLpWhXnzqN9A3VSzMzraV/9SY9kGQkw8xNA==} + '@zardoy/flying-squid@0.0.20': + resolution: {integrity: sha512-WyejZS2Upzv86g6Ez5Z/4Pd0ea9tkFL2itAj24UNpO7fyzxuTN2Ag1Ouvh+MSkCloXhR4E/yoER2krHW8vzwBw==} engines: {node: '>=8'} hasBin: true @@ -11913,7 +11913,7 @@ snapshots: '@types/emscripten': 1.39.8 tslib: 1.14.1 - '@zardoy/flying-squid@0.0.19(encoding@0.1.13)': + '@zardoy/flying-squid@0.0.20(encoding@0.1.13)': dependencies: change-case: 4.1.2 colors: 1.4.0 diff --git a/src/flyingSquidUtils.ts b/src/flyingSquidUtils.ts index 2590468d..bd312bfb 100644 --- a/src/flyingSquidUtils.ts +++ b/src/flyingSquidUtils.ts @@ -38,4 +38,5 @@ export const disconnect = async () => { } window.history.replaceState({}, '', `${window.location.pathname}`) // remove qs bot.end('You left the server') + location.reload() } diff --git a/src/react/AppStatus.tsx b/src/react/AppStatus.tsx index b1b98c35..9bf2ece1 100644 --- a/src/react/AppStatus.tsx +++ b/src/react/AppStatus.tsx @@ -44,7 +44,7 @@ export default ({ status, isError, hideDots = false, lastStatus = '', backAction <> {backAction && + )} diff --git a/src/react/PauseScreen.tsx b/src/react/PauseScreen.tsx index a224f9e6..0d63df5d 100644 --- a/src/react/PauseScreen.tsx +++ b/src/react/PauseScreen.tsx @@ -137,7 +137,7 @@ export default () => { ) : null} From 3046524ff6243dbcccb43985cf11970ac02b76f6 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Wed, 8 May 2024 20:36:05 +0300 Subject: [PATCH 4/4] chore: fix all tests feat: add lockConnect to QS options for alt connection screen UI --- README.MD | 9 +++++---- cypress/e2e/index.spec.ts | 4 ++-- src/react/{AddServer.tsx => AddServerOrConnect.tsx} | 6 +++--- src/react/ServersList.stories.tsx | 4 ++-- src/react/ServersListProvider.tsx | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) rename src/react/{AddServer.tsx => AddServerOrConnect.tsx} (96%) diff --git a/README.MD b/README.MD index 1b8b84ac..bc39fb98 100644 --- a/README.MD +++ b/README.MD @@ -103,10 +103,11 @@ world chunks have a *yellow* border, hostile mobs have a *red* outline, passive Press `Y` to set query parameters to url of your current game state. -- `?server=` - Display connect screen to the server on load -- `?username=` - Set the username on load -- `?proxy=` - Set the proxy server address on load -- `?version=` - Set the version on load +- `?ip=` - Display connect screen to the server on load +- `?username=` - Set the username for server +- `?proxy=` - Set the proxy server address to use for server +- `?version=` - Set the version for server +- `?lockConnect=true` - Disable cancel / save buttons, useful for integrates iframes - `?reconnect=true` - Reconnect to the server on page reloads. Available in **dev mode only** and very useful on server testing. - `?loadSave=` - Load the save on load with the specified folder name (not title) diff --git a/cypress/e2e/index.spec.ts b/cypress/e2e/index.spec.ts index 35399393..455b1283 100644 --- a/cypress/e2e/index.spec.ts +++ b/cypress/e2e/index.spec.ts @@ -38,7 +38,7 @@ const setOptions = (options: Partial) => { } it('Loads & renders singleplayer', () => { - cleanVisit('/?singleplayer=1') + visit('/?singleplayer=1') setOptions({ localServerOptions: { generation: { @@ -52,7 +52,7 @@ it('Loads & renders singleplayer', () => { testWorldLoad() }) -it.only('Joins to server', () => { +it('Joins to server', () => { visit('/?ip=localhost&version=1.16.1') window.localStorage.version = '' // todo replace with data-test diff --git a/src/react/AddServer.tsx b/src/react/AddServerOrConnect.tsx similarity index 96% rename from src/react/AddServer.tsx rename to src/react/AddServerOrConnect.tsx index bae39ac9..54f04af1 100644 --- a/src/react/AddServer.tsx +++ b/src/react/AddServerOrConnect.tsx @@ -38,6 +38,7 @@ export default ({ onBack, onConfirm, title = 'Add a Server', initialData, parseQ const [usernameOverride, setUsernameOverride] = React.useState(initialData?.usernameOverride ?? qsParams?.get('username') ?? '') const [passwordOverride, setPasswordOverride] = React.useState(initialData?.passwordOverride ?? qsParams?.get('password') ?? '') const smallWidth = useIsSmallWidth() + const lockConnect = qsParams?.get('lockConnect') === 'true' return
setProxyOverride(value)} placeholder={defaults?.proxyOverride} /> setUsernameOverride(value)} placeholder={defaults?.usernameOverride} /> setPasswordOverride(value)} /* placeholder='For advanced usage only' */ /> - - + } }>Cancel} {qsParams?.get('ip') &&