Skip to content

Commit

Permalink
Fix installing OptiFine with 1.16+
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafHacker committed Jan 2, 2021
1 parent 0622f0c commit 2405895
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixes
- Fix an error when attempting to install OptiFine with 1.16+

## [0.9.4] - 2021-01-02

### Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,34 +226,40 @@ private JPanel buildOptiFineSetting(AppWindow app) {
grid.add(radial);

if (usingOptiFine) {
String version = config.getSettingValue(OptiFineSetting.INSTANCE);
String warningText = version == null ? "OptiFine is not currently supported on this version.<br>A new Installer that supports this combination may be released in the future."
: "OptiFine can sometimes cause visual issues in Impact;<br>only include it if you need it!";

JPanel warning = new JPanel(new FlowLayout());
warning.add(new JLabel("<html><center>OptiFine can sometimes cause visual issues in Impact;<br>only include it if you need it!</center></html>"));
warning.add(new JLabel("<html><center>" + warningText + "</center></html>"));
grid.add(warning);

String version = config.getSettingValue(OptiFineSetting.INSTANCE);
if (!version.equals(MISSING)) {
grid.add(buildSetting(OptiFineSetting.INSTANCE, "OptiFine version", app));
}
switch (version) {
case MISSING:
case CUSTOM:
grid.add(buildPathSetting(OptiFineFileSetting.INSTANCE, "OptiFine installer", JFileChooser.FILES_ONLY, app));
break;
}
// OptiFine version can be null if it isn't supported
if (version != null) {
if (!version.equals(MISSING)) {
grid.add(buildSetting(OptiFineSetting.INSTANCE, "OptiFine version", app));
}
switch (version) {
case MISSING:
case CUSTOM:
grid.add(buildPathSetting(OptiFineFileSetting.INSTANCE, "OptiFine installer", JFileChooser.FILES_ONLY, app));
break;
}

try {
FlowLayout layout = new FlowLayout();
layout.setHgap(0);
JPanel download = new JPanel(layout);
JLabel text = new JLabel("<html>You can download OptiFine from their website: </html>");
download.add(text);

JHyperlink link = new JHyperlink("optifine.net", "https://optifine.net/downloads");
download.add(link);

grid.add(download);
} catch (URISyntaxException e) {
throw new RuntimeException("", e);
try {
FlowLayout layout = new FlowLayout();
layout.setHgap(0);
JPanel download = new JPanel(layout);
JLabel text = new JLabel("<html>You can download OptiFine from their website: </html>");
download.add(text);

JHyperlink link = new JHyperlink("optifine.net", "https://optifine.net/downloads");
download.add(link);

grid.add(download);
} catch (URISyntaxException e) {
throw new RuntimeException("", e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public enum OptiFineSetting implements ChoiceSetting<String> {

@Override
public List<String> getPossibleValues(InstallationConfig config) {
if (config.getSettingValue(InstallationModeSetting.INSTANCE) == InstallationModeOptions.FORGE || config.getSettingValue(InstallationModeSetting.INSTANCE) == InstallationModeOptions.FORGE_PLUS_LITELOADER || config.getSettingValue(MinecraftVersionSetting.INSTANCE).compareTo("1.15.2") > 0) {
if (config.getSettingValue(InstallationModeSetting.INSTANCE) == InstallationModeOptions.FORGE || config.getSettingValue(InstallationModeSetting.INSTANCE) == InstallationModeOptions.FORGE_PLUS_LITELOADER) {
return Collections.emptyList();
}
String minecraftVersion = config.getSettingValue(MinecraftVersionSetting.INSTANCE);
Expand Down

0 comments on commit 2405895

Please sign in to comment.