@@ -98,6 +98,7 @@ import { tryHandleBuiltinCommand } from './builtinCommands'
9898import { loadingTimerState } from './react/LoadingTimer'
9999import { loadPluginsIntoWorld } from './react/CreateWorldProvider'
100100import { getCurrentProxy , getCurrentUsername } from './react/ServersList'
101+ import { versionToNumber } from 'mc-assets/dist/utils'
101102import { isPlayground } from './playgroundIntegration'
102103import { appLoadBackend } from './appViewerLoad'
103104
@@ -395,6 +396,19 @@ export async function connect (connectOptions: ConnectOptions) {
395396
396397 let finalVersion = connectOptions . botVersion || ( singleplayer ? serverOptions . version : undefined )
397398
399+ // Check for forbidden versions (>= 1.21.7) due to critical world display issues
400+ const checkForbiddenVersion = ( version : string | undefined ) => {
401+ if ( ! version ) return
402+ const FORBIDDEN_VERSION_THRESHOLD = '1.21.7'
403+ const versionNum = versionToNumber ( version )
404+ const thresholdNum = versionToNumber ( FORBIDDEN_VERSION_THRESHOLD )
405+ if ( versionNum >= thresholdNum ) {
406+ throw new UserError ( `Version ${ version } is not supported due to critical world display issues. Please use version 1.21.6 or earlier.` )
407+ }
408+ }
409+
410+ checkForbiddenVersion ( finalVersion )
411+
398412 if ( connectOptions . worldStateFileContents ) {
399413 try {
400414 localReplaySession = startLocalReplayServer ( connectOptions . worldStateFileContents )
@@ -403,6 +417,7 @@ export async function connect (connectOptions: ConnectOptions) {
403417 throw new UserError ( `Failed to start local replay server: ${ err } ` )
404418 }
405419 finalVersion = localReplaySession . version
420+ checkForbiddenVersion ( finalVersion )
406421 }
407422
408423 if ( singleplayer ) {
@@ -465,6 +480,7 @@ export async function connect (connectOptions: ConnectOptions) {
465480 const autoVersionSelect = await getServerInfo ( server . host , server . port ? Number ( server . port ) : undefined , versionAutoSelect )
466481 wrapped . end ( )
467482 finalVersion = autoVersionSelect . version
483+ checkForbiddenVersion ( finalVersion )
468484 }
469485 initialLoadingText = `Connecting to server ${ server . host } :${ server . port ?? 25_565 } with version ${ finalVersion } `
470486 } else if ( connectOptions . viewerWsConnect ) {
@@ -513,6 +529,7 @@ export async function connect (connectOptions: ConnectOptions) {
513529 console . log ( 'Latency:' , Date . now ( ) - time , 'ms' )
514530 // const version = '1.21.1'
515531 finalVersion = version
532+ checkForbiddenVersion ( finalVersion )
516533 await downloadMcData ( version )
517534 setLoadingScreenStatus ( `Connecting to WebSocket server ${ connectOptions . viewerWsConnect } ` )
518535 clientDataStream = ( await getWsProtocolStream ( connectOptions . viewerWsConnect ) ) . clientDuplex
0 commit comments