修复无法正常启动 Minecraft 13w16a~13w23b 的问题 (#7193)

This commit is contained in:
Glavo authored and GitHub committed 2026-11-04 22:23:24 +08:00
1 parent 3f6e7fcffd
commit 087b2b678d
2 files changed
+17 -5

No files matched your search

@@ -91,6 +91,12 @@ public final class HMCLGameLauncher extends DefaultLauncher {
if (gameVersion == GameVersionNumber.unknown() || gameVersion.compareTo("1.1") < 0)
return;
// These snapshots lack the external language resources needed for non-English locales.
// Selecting an unavailable language causes a NullPointerException during startup.
if (gameVersion instanceof GameVersionNumber.LegacySnapshot
&& gameVersion.compareTo("13w16a") >= 0 && gameVersion.compareTo("13w23b") <= 0)
return;
String lang = normalizedLanguageTag(locale, gameVersion);
if (lang.isEmpty())
return;
@@ -409,11 +409,17 @@ public class DefaultLauncher extends Launcher {
return new Command(res, tempNativeFolder, javaNativeFolder, encoding);
}
public Map<String, Boolean> getFeatures() {
return Collections.singletonMap(
"has_custom_resolution",
options.getHeight() != null && options.getHeight() != 0 && options.getWidth() != null && options.getWidth() != 0
);
/// Returns the feature flags used to evaluate conditional game arguments.
/// The `has_custom_resolution` flag is enabled when both dimensions are non-null and nonzero
/// and the game version is at least `1.6` (snapshot `13w25a`).
///
/// @return an unmodifiable snapshot containing the custom resolution flag
public @Unmodifiable Map<String, Boolean> getFeatures() {
boolean hasCustomResolution = options.getHeight() != null && options.getHeight() != 0
&& options.getWidth() != null && options.getWidth() != 0
&& instance.getVersion().isAtLeast("1.6", "13w25a");
return Collections.singletonMap("has_custom_resolution", hasCustomResolution);
}
private final Map<String, Supplier<Boolean>> forbiddens = mapOf(