late release (#114)
This commit is contained in:
commit
05624b2dc5
15 changed files with 83 additions and 70 deletions
|
|
@ -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=<server_address>` - Display connect screen to the server on load
|
||||
- `?username=<username>` - Set the username on load
|
||||
- `?proxy=<proxy_address>` - Set the proxy server address on load
|
||||
- `?version=<version>` - Set the version on load
|
||||
- `?ip=<server_address>` - Display connect screen to the server on load
|
||||
- `?username=<username>` - Set the username for server
|
||||
- `?proxy=<proxy_address>` - Set the proxy server address to use for server
|
||||
- `?version=<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.
|
||||
<!-- - `?password=<password>` - Set the password on load -->
|
||||
- `?loadSave=<save_name>` - Load the save on load with the specified folder name (not title)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const setOptions = (options: Partial<AppOptions>) => {
|
|||
}
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -62,14 +62,14 @@
|
|||
"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",
|
||||
"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",
|
||||
|
|
|
|||
70
pnpm-lock.yaml
generated
70
pnpm-lock.yaml
generated
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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:
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -32,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)
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ export abstract class WorldRendererCommon<WorkerSend = any, WorkerReceive = any>
|
|||
allChunksFinished = false
|
||||
handleResize = () => { }
|
||||
mesherConfig = defaultMesherConfig
|
||||
camera: THREE.PerspectiveCamera
|
||||
|
||||
abstract outputFormat: 'threeJs' | 'webgl'
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,4 +38,5 @@ export const disconnect = async () => {
|
|||
}
|
||||
window.history.replaceState({}, '', `${window.location.pathname}`) // remove qs
|
||||
bot.end('You left the server')
|
||||
location.reload()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <Screen title={qsParams?.get('ip') ? 'Connect to Server' : title} backdrop>
|
||||
<form style={{
|
||||
|
|
@ -74,10 +75,9 @@ export default ({ onBack, onConfirm, title = 'Add a Server', initialData, parseQ
|
|||
<InputWithLabel label="Proxy Override" value={proxyOverride} onChange={({ target: { value } }) => setProxyOverride(value)} placeholder={defaults?.proxyOverride} />
|
||||
<InputWithLabel label="Username Override" value={usernameOverride} onChange={({ target: { value } }) => setUsernameOverride(value)} placeholder={defaults?.usernameOverride} />
|
||||
<InputWithLabel label="Password Override" value={passwordOverride} onChange={({ target: { value } }) => setPasswordOverride(value)} /* placeholder='For advanced usage only' */ />
|
||||
<Button onClick={() => {
|
||||
{!lockConnect && <><Button onClick={() => {
|
||||
onBack()
|
||||
}}>Cancel</Button>
|
||||
<Button type='submit'>Save</Button>
|
||||
} }>Cancel</Button><Button type='submit'>Save</Button></>}
|
||||
{qsParams?.get('ip') && <div style={{ gridColumn: smallWidth ? '' : 'span 2', display: 'flex', justifyContent: 'center' }}>
|
||||
<Button
|
||||
data-test-id='connect-qs'
|
||||
|
|
@ -44,7 +44,7 @@ export default ({ status, isError, hideDots = false, lastStatus = '', backAction
|
|||
<>
|
||||
{backAction && <Button label="Back" onClick={backAction} />}
|
||||
{actionsSlot}
|
||||
<Button onClick={() => window.location.reload()} label="Full Reload" ></Button>
|
||||
<Button onClick={() => window.location.reload()} label="Reset App (recommended)"></Button>
|
||||
</>
|
||||
)}
|
||||
</Screen>
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ export default () => {
|
|||
</div>
|
||||
) : null}
|
||||
<Button className="button" style={{ width: '204px' }} onClick={disconnect}>
|
||||
{localServer && !fsState.syncFs && !fsState.isReadonly ? 'Save & Quit' : 'Disconnect'}
|
||||
{localServer && !fsState.syncFs && !fsState.isReadonly ? 'Save & Quit' : 'Disconnect & Reset'}
|
||||
</Button>
|
||||
</div>
|
||||
</Screen>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react'
|
|||
import 'iconify-icon'
|
||||
|
||||
import { useState } from 'react'
|
||||
import AddServer from './AddServer'
|
||||
import AddServerOrConnect from './AddServerOrConnect'
|
||||
import ServersList from './ServersList'
|
||||
|
||||
const meta: Meta<typeof ServersList> = {
|
||||
|
|
@ -12,7 +12,7 @@ const meta: Meta<typeof ServersList> = {
|
|||
const [username, setUsername] = useState('')
|
||||
|
||||
return addOpen ?
|
||||
<AddServer onBack={() => {
|
||||
<AddServerOrConnect onBack={() => {
|
||||
setAddOpen(false)
|
||||
}}
|
||||
onConfirm={(info) => {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { qsOptions } from '../optionsStorage'
|
|||
import { ConnectOptions } from '../connect'
|
||||
import { hideCurrentModal, miscUiState, showModal } from '../globalState'
|
||||
import ServersList from './ServersList'
|
||||
import AddServer from './AddServer'
|
||||
import AddServerOrConnect from './AddServerOrConnect'
|
||||
import { useDidUpdateEffect } from './utils'
|
||||
import { useIsModalActive } from './utilsApp'
|
||||
|
||||
|
|
@ -180,20 +180,17 @@ const Inner = () => {
|
|||
|
||||
const isEditScreenModal = useIsModalActive('editServer')
|
||||
|
||||
useEffect(() => {
|
||||
if (!isEditScreenModal) {
|
||||
setServerEditScreen(null)
|
||||
}
|
||||
}, [isEditScreenModal])
|
||||
|
||||
useEffect(() => {
|
||||
useDidUpdateEffect(() => {
|
||||
if (serverEditScreen && !isEditScreenModal) {
|
||||
showModal({ reactType: 'editServer' })
|
||||
}
|
||||
if (!serverEditScreen && isEditScreenModal) {
|
||||
hideCurrentModal()
|
||||
}
|
||||
}, [serverEditScreen])
|
||||
|
||||
if (isEditScreenModal) {
|
||||
return <AddServer
|
||||
return <AddServerOrConnect
|
||||
defaults={{
|
||||
proxyOverride: selectedProxy,
|
||||
usernameOverride: defaultUsername,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue