minecraft-renderer 0.1.57 → 0.1.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-renderer",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "The most Modular Minecraft world renderer with Three.js WebGL backend",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -133,7 +133,8 @@ export const getDefaultRendererState = (): {
133
133
  avgRenderTime: 0,
134
134
  world: {
135
135
  chunksLoaded: new Set(),
136
- chunksTotalNumber: 0
136
+ chunksTotalNumber: 0,
137
+ chunksFullInfo: '-'
137
138
  },
138
139
  renderer: {
139
140
  timeline: {
@@ -60,6 +60,7 @@ export interface NonReactiveState {
60
60
  world: {
61
61
  chunksLoaded: Set<string>
62
62
  chunksTotalNumber: number
63
+ chunksFullInfo: string
63
64
  allChunksLoaded?: boolean
64
65
  }
65
66
  renderer: {
@@ -690,6 +690,7 @@ export abstract class WorldRendererCommon<WorkerSend = any, WorkerReceive = any>
690
690
 
691
691
  const text = `Q: ${this.messageQueue.length} ${Object.keys(this.loadedChunks).length}/${Object.keys(this.finishedChunks).length}/${this.chunksLength} chunks (${this.workers.length}:${this.workersProcessAverageTime.toFixed(0)}ms/${this.geometryReceiveCountPerSec}ss/${this.allLoadedIn?.toFixed(1) ?? '-'}s)`
692
692
  this.chunksFullInfo = text
693
+ this.displayOptions.nonReactiveState.world.chunksFullInfo = text
693
694
  updateStatText('downloaded-chunks', text)
694
695
  }
695
696
 
@@ -4,7 +4,7 @@ import { GraphicsBackend, GraphicsBackendLoader } from '../graphicsBackend'
4
4
  import { useWorkerProxy, deepPrepareForTransfer, findProblemTransfer } from '../lib/workerProxy'
5
5
  import { meshersSendMcDataAwait } from '../lib/worldrendererCommon'
6
6
  import { dynamicMcDataFiles } from '../lib/buildSharedConfig.mjs'
7
- import { addNewStat } from '../lib/ui/newStats'
7
+ import { addNewStat, MC_RENDERER_DEBUG_OVERLAY_CLASS } from '../lib/ui/newStats'
8
8
  import type { MenuBackgroundOptions } from './menuBackground/types'
9
9
  import { MENU_BACKGROUND_MC_VERSION } from './menuBackground/shared'
10
10
  import { createGraphicsBackendBase, type ThreeJsBackendMethods } from './graphicsBackendBase'
@@ -122,6 +122,17 @@ export const createGraphicsBackendOffThread: GraphicsBackendLoader = async (init
122
122
  fpsStat.updateText(`FPS: ${fps.toFixed(0)} (${avgRenderTime.toFixed(0)}ms/${worstRenderTime.toFixed(0)}ms)`)
123
123
  options.nonReactiveState.fps = 0
124
124
  }, 1000)
125
+
126
+ const chunksStat = addNewStat('downloaded-chunks', 100, 140, 20, {
127
+ className: MC_RENDERER_DEBUG_OVERLAY_CLASS,
128
+ })
129
+ setInterval(() => {
130
+ const advanced = (initOptions.config.statsVisible ?? 0) > 1
131
+ chunksStat.setVisibility(advanced)
132
+ if (advanced) {
133
+ chunksStat.updateText(options.nonReactiveState.world.chunksFullInfo)
134
+ }
135
+ }, 200)
125
136
  },
126
137
  disconnect() {
127
138
  canvas.destroy()