@@ -8,13 +8,15 @@ import { proxy, subscribe } from 'valtio'
8
8
import { getDefaultRendererState } from 'renderer/viewer/baseGraphicsBackend'
9
9
import { getSyncWorld } from 'renderer/playground/shared'
10
10
import { MaybePromise } from 'contro-max/build/types/store'
11
+ import { PANORAMA_VERSION } from 'renderer/viewer/three/panoramaShared'
11
12
import { playerState } from './mineflayer/playerState'
12
13
import { createNotificationProgressReporter , ProgressReporter } from './core/progressReporter'
13
14
import { setLoadingScreenStatus } from './appStatus'
14
15
import { activeModalStack , miscUiState } from './globalState'
15
16
import { options } from './optionsStorage'
16
17
import { ResourcesManager , ResourcesManagerTransferred } from './resourcesManager'
17
18
import { watchOptionsAfterWorldViewInit } from './watchOptions'
19
+ import { loadMinecraftData } from './connect'
18
20
19
21
export interface RendererReactiveState {
20
22
world : {
@@ -112,7 +114,7 @@ export class AppViewer {
112
114
inWorldRenderingConfig : WorldRendererConfig = proxy ( defaultWorldRendererConfig )
113
115
lastCamUpdate = 0
114
116
playerState = playerState
115
- rendererState = proxy ( getDefaultRendererState ( ) . reactive )
117
+ rendererState = getDefaultRendererState ( ) . reactive
116
118
nonReactiveState : NonReactiveState = getDefaultRendererState ( ) . nonReactive
117
119
worldReady : Promise < void >
118
120
private resolveWorldReady : ( ) => void
@@ -162,11 +164,15 @@ export class AppViewer {
162
164
163
165
// Execute queued action if exists
164
166
if ( this . currentState ) {
165
- const { method, args } = this . currentState
166
- this . backend [ method ] ( ...args )
167
- if ( method === 'startWorld' ) {
168
- void this . worldView ! . init ( bot . entity . position )
169
- // void this.worldView!.init(args[0].playerState.getPosition())
167
+ if ( this . currentState . method === 'startPanorama' ) {
168
+ this . startPanorama ( )
169
+ } else {
170
+ const { method, args } = this . currentState
171
+ this . backend [ method ] ( ...args )
172
+ if ( method === 'startWorld' ) {
173
+ void this . worldView ! . init ( bot . entity . position )
174
+ // void this.worldView!.init(args[0].playerState.getPosition())
175
+ }
170
176
}
171
177
}
172
178
@@ -225,10 +231,16 @@ export class AppViewer {
225
231
226
232
startPanorama ( ) {
227
233
if ( this . currentDisplay === 'menu' ) return
228
- this . currentDisplay = 'menu'
229
234
if ( options . disableAssets ) return
230
- if ( this . backend ) {
231
- this . backend . startPanorama ( )
235
+ if ( this . backend && ! hasAppStatus ( ) ) {
236
+ this . currentDisplay = 'menu'
237
+ if ( process . env . SINGLE_FILE_BUILD_MODE ) {
238
+ void loadMinecraftData ( PANORAMA_VERSION ) . then ( ( ) => {
239
+ this . backend ?. startPanorama ( )
240
+ } )
241
+ } else {
242
+ this . backend . startPanorama ( )
243
+ }
232
244
}
233
245
this . currentState = { method : 'startPanorama' , args : [ ] }
234
246
}
@@ -316,15 +328,16 @@ const initialMenuStart = async () => {
316
328
}
317
329
window . initialMenuStart = initialMenuStart
318
330
331
+ const hasAppStatus = ( ) => activeModalStack . some ( m => m . reactType === 'app-status' )
332
+
319
333
const modalStackUpdateChecks = ( ) => {
320
334
// maybe start panorama
321
- if ( ! miscUiState . gameLoaded ) {
335
+ if ( ! miscUiState . gameLoaded && ! hasAppStatus ( ) ) {
322
336
void initialMenuStart ( )
323
337
}
324
338
325
339
if ( appViewer . backend ) {
326
- const hasAppStatus = activeModalStack . some ( m => m . reactType === 'app-status' )
327
- appViewer . backend . setRendering ( ! hasAppStatus )
340
+ appViewer . backend . setRendering ( ! hasAppStatus ( ) )
328
341
}
329
342
330
343
appViewer . inWorldRenderingConfig . foreground = activeModalStack . length === 0
0 commit comments