another fix for correct view distance in p-viewer
emit error when resourecpack size exceeds browser limit worker models: improve perf when loading big number of chunks (still not ideal, should be a setting I think as I like more prev behavior)
This commit is contained in:
parent
038137940a
commit
83f7aee586
5 changed files with 16 additions and 5 deletions
|
|
@ -14,7 +14,8 @@
|
|||
"test-mc-server": "tsx cypress/minecraft-server.mjs",
|
||||
"lint": "eslint \"{src,cypress}/**/*.{ts,js,jsx,tsx}\"",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"build-storybook": "storybook build"
|
||||
"build-storybook": "storybook build",
|
||||
"watch-worker": "node prismarine-viewer/buildWorker.mjs -w"
|
||||
},
|
||||
"keywords": [
|
||||
"prismarine",
|
||||
|
|
|
|||
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
|
|
@ -63,7 +63,7 @@ importers:
|
|||
version: 4.18.2
|
||||
flying-squid:
|
||||
specifier: github:zardoy/space-squid#everything
|
||||
version: github.com/zardoy/space-squid/bdf1e0859ad435bf722e5b7794b84a50b84c5c7f
|
||||
version: github.com/zardoy/space-squid/85dd6ed6eb645a6536dc34465e9e10c1979d9eee
|
||||
fs-extra:
|
||||
specifier: ^11.1.1
|
||||
version: 11.1.1
|
||||
|
|
@ -14467,8 +14467,8 @@ packages:
|
|||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
github.com/zardoy/space-squid/bdf1e0859ad435bf722e5b7794b84a50b84c5c7f:
|
||||
resolution: {tarball: https://codeload.github.com/zardoy/space-squid/tar.gz/bdf1e0859ad435bf722e5b7794b84a50b84c5c7f}
|
||||
github.com/zardoy/space-squid/85dd6ed6eb645a6536dc34465e9e10c1979d9eee:
|
||||
resolution: {tarball: https://codeload.github.com/zardoy/space-squid/tar.gz/85dd6ed6eb645a6536dc34465e9e10c1979d9eee}
|
||||
name: flying-squid
|
||||
version: 1.5.0
|
||||
engines: {node: '>=8'}
|
||||
|
|
|
|||
|
|
@ -245,6 +245,8 @@ function renderElement (world, cursor, element, doAO, attr, globalMatrix, global
|
|||
if (neighbor) {
|
||||
if (cullIfIdentical && neighbor.type === block.type) continue
|
||||
if (!neighbor.transparent && neighbor.isCube) continue
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export class WorldDataEmitter extends EventEmitter {
|
|||
const [botX, botZ] = chunkPos(this.lastPos)
|
||||
const dx = Math.abs(botX - Math.floor(pos.x / 16))
|
||||
const dz = Math.abs(botZ - Math.floor(pos.z / 16))
|
||||
if (dx < this.viewDistance && dz < this.viewDistance) {
|
||||
if (dx <= this.viewDistance && dz <= this.viewDistance) {
|
||||
const column = await this.world.getColumnAt(pos['y'] ? pos as Vec3 : new Vec3(pos.x, 0, pos.z))
|
||||
if (column) {
|
||||
// todo optimize toJson data, make it clear why it is used
|
||||
|
|
@ -124,6 +124,9 @@ export class WorldDataEmitter extends EventEmitter {
|
|||
this.emitter.emit('loadChunk', { x: pos.x, z: pos.z, chunk, blockEntities: column.blockEntities, worldConfig })
|
||||
this.loadedChunks[`${pos.x},${pos.z}`] = true
|
||||
}
|
||||
} else {
|
||||
// todo should not happend in singleplayer
|
||||
console.log('skipped loading chunk', dx, dz, '>', this.viewDistance)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,6 +206,11 @@ export const genTexturePackTextures = async (version: string) => {
|
|||
|
||||
const imgSize = texSize * tileSize
|
||||
|
||||
const MAX_CANVAS_SIZE = 16_384
|
||||
if (imgSize > MAX_CANVAS_SIZE) {
|
||||
throw new Error(`Texture pack texture resolution is too big, max size is ${MAX_CANVAS_SIZE}x${MAX_CANVAS_SIZE}`)
|
||||
// texSize = nextPowerOfTwo(Math.ceil(Math.sqrt(textureFiles.length / 2)))
|
||||
}
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = imgSize
|
||||
canvas.height = imgSize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue