在修改游戏版本时清除已选的模组加载器 (#6475)

This commit is contained in:
辞庐
2026-09-08 21:57:16 +08:00
committed by GitHub
parent b97e7fbd55
commit ce51dc4dd7
@@ -59,7 +59,7 @@ class AdditionalInstallersPage extends AbstractInstallersPage {
});
}
installable.bind(Bindings.createBooleanBinding(() -> compatible.get() && txtName.validate(), txtName.textProperty(), compatible));
installable.bind(Bindings.createBooleanBinding(() -> txtName.validate(), txtName.textProperty()));
}
@Override
@@ -80,27 +80,14 @@ class AdditionalInstallersPage extends AbstractInstallersPage {
@Override
protected void reload() {
boolean gameVersionChanged = !instance.getVersion().toString().equals(getVersion(GameComponentType.GAME));
boolean compatible = true;
for (InstallerItem component : group.getComponents()) {
GameComponentType componentType = component.getComponentType();
String version = instance.getComponentVersion(component.getComponentType());
String libraryVersion = Lang.requireNonNullElse(getVersion(componentType), version);
boolean alreadyInstalled = version != null && !(controller.getSettings().get(componentType.getPatchId()) instanceof UpdateInstallerWizardProvider.RemoveComponentAction);
if (component.getComponentType() != GameComponentType.GAME && gameVersionChanged && getVersion(componentType) == null && alreadyInstalled) {
// For third-party libraries, if game version is being changed, and the library is not being reinstalled,
// warns the user that we should update the library.
component.versionProperty().set(new InstallerItem.InstalledState(libraryVersion, false, true));
compatible = false;
} else if (alreadyInstalled || getVersion(componentType) != null) {
component.versionProperty().set(new InstallerItem.InstalledState(libraryVersion, false, false));
if (controller.getSettings().containsKey(componentType.getPatchId())) {
component.versionProperty().set(new InstallerItem.InstalledState(getVersion(componentType), false, false));
} else {
component.versionProperty().set(null);
}
}
this.compatible.set(compatible);
}
@Override