Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public AdditionalInstallersPage(HMCLGameInstance instance, String gameVersion, W
});
}

installable.bind(Bindings.createBooleanBinding(() -> compatible.get() && txtName.validate(), txtName.textProperty(), compatible));
installable.bind(Bindings.createBooleanBinding(() -> txtName.validate(), txtName.textProperty()));
}

@Override
Expand All @@ -80,27 +80,14 @@ private String getVersion(GameComponentType type) {

@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));
Comment on lines +85 to +86

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat removal actions as unselected components

When a user selects a loader, clicks its remove button, and then tries to select an incompatible alternative, the setting still contains a RemoveVersionAction, so this branch renders the removed loader as InstalledState(null, ...). InstallerItemGroup consequently keeps alternatives such as Forge and Fabric mutually incompatible and prevents the replacement from being selected; it also continues showing the removed loader as installed. Check for a selected RemoteVersion rather than mere key presence so removal actions render as unselected.

Useful? React with 👍 / 👎.

} else {
component.versionProperty().set(null);
}
}

this.compatible.set(compatible);
}

@Override
Expand Down