Skip to content

Commit 02772dd

Browse files
committed
dont forbid 1.21.8 but limit its usage in singleplayer
1 parent 007782b commit 02772dd

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ import { getCurrentProxy, getCurrentUsername } from './react/ServersList'
101101
import { versionToNumber } from 'mc-assets/dist/utils'
102102
import { isPlayground } from './playgroundIntegration'
103103
import { appLoadBackend } from './appViewerLoad'
104+
import { FORBIDDEN_VERSION_THRESHOLD } from './supportedVersions.mjs'
104105

105106
window.debug = debug
106107
window.beforeRenderFrame = []
@@ -399,11 +400,10 @@ export async function connect (connectOptions: ConnectOptions) {
399400
// Check for forbidden versions (>= 1.21.7) due to critical world display issues
400401
const checkForbiddenVersion = (version: string | undefined) => {
401402
if (!version) return
402-
const FORBIDDEN_VERSION_THRESHOLD = '1.21.7'
403403
const versionNum = versionToNumber(version)
404404
const thresholdNum = versionToNumber(FORBIDDEN_VERSION_THRESHOLD)
405405
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.`)
406+
throw new UserError(`Version ${version} is not supported due to critical world display issues. Please use version ${FORBIDDEN_VERSION_THRESHOLD} or earlier.`)
407407
}
408408
}
409409

src/react/CreateWorldProvider.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'path'
33
import { hideCurrentModal, showModal } from '../globalState'
44
import defaultLocalServerOptions from '../defaultLocalServerOptions'
55
import { mkdirRecursive, uniqueFileNameFromWorldName } from '../browserfs'
6-
import supportedVersions from '../supportedVersions.mjs'
6+
import supportedVersions, { FORBIDDEN_VERSION_THRESHOLD_SINGLEPLAYER, versionToNumber } from '../supportedVersions.mjs'
77
import { getServerPlugin } from '../clientMods'
88
import CreateWorld, { WorldCustomize, creatingWorldState } from './CreateWorld'
99
import { getWorldsPath } from './SingleplayerProvider'
@@ -13,7 +13,12 @@ export default () => {
1313
const activeCreate = useIsModalActive('create-world')
1414
const activeCustomize = useIsModalActive('customize-world')
1515
if (activeCreate) {
16-
const versionsPerMinor = Object.fromEntries(supportedVersions.map(x => [x.split('.').slice(0, 2), x]))
16+
const forbiddenThresholdNum = versionToNumber(FORBIDDEN_VERSION_THRESHOLD_SINGLEPLAYER)
17+
const filteredVersions = supportedVersions.filter(x => {
18+
const versionNum = versionToNumber(x)
19+
return versionNum < forbiddenThresholdNum
20+
})
21+
const versionsPerMinor = Object.fromEntries(filteredVersions.map(x => [x.split('.').slice(0, 2), x]))
1722
const versions = Object.values(versionsPerMinor).map(x => {
1823
return {
1924
version: x,

src/supportedVersions.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const versionsFromProtocol = Object.values(postNettyVersionsByProtocolVersion.pc
77

88
export const notTestedVersions = '1.19.3 1.20 1.19.1 1.19 1.18.1 1.15.1 1.14.1'.split(' ')
99

10-
// Versions >= 1.21.7 are forbidden due to critical world display issues
11-
const FORBIDDEN_VERSION_THRESHOLD = '1.21.7'
12-
const versionToNumber = (ver) => {
10+
export const FORBIDDEN_VERSION_THRESHOLD = '1.21.1000'
11+
export const FORBIDDEN_VERSION_THRESHOLD_SINGLEPLAYER = '1.21.7'
12+
export const versionToNumber = (ver) => {
1313
const [x, y = '0', z = '0'] = ver.split('.')
1414
return +`${x.padStart(2, '0')}${y.padStart(2, '0')}${z.padStart(2, '0')}`
1515
}

0 commit comments

Comments
 (0)