MultiMC modpack patch json file may have "+libraries" or "libraries"
This commit is contained in:
@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.mod;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import org.jackhuang.hmcl.game.Library;
|
import org.jackhuang.hmcl.game.Library;
|
||||||
import org.jackhuang.hmcl.util.Immutable;
|
import org.jackhuang.hmcl.util.Immutable;
|
||||||
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -44,19 +45,23 @@ public final class MultiMCInstancePatch {
|
|||||||
private final List<String> tweakers;
|
private final List<String> tweakers;
|
||||||
|
|
||||||
@SerializedName("+libraries")
|
@SerializedName("+libraries")
|
||||||
|
private final List<Library> _libraries;
|
||||||
|
|
||||||
|
@SerializedName("libraries")
|
||||||
private final List<Library> libraries;
|
private final List<Library> libraries;
|
||||||
|
|
||||||
public MultiMCInstancePatch() {
|
public MultiMCInstancePatch() {
|
||||||
this("", "", "", "", "", Collections.emptyList(), Collections.emptyList());
|
this("", "", "", "", "", Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiMCInstancePatch(String name, String version, String gameVersion, String mainClass, String fileId, List<String> tweakers, List<Library> libraries) {
|
public MultiMCInstancePatch(String name, String version, String gameVersion, String mainClass, String fileId, List<String> tweakers, List<Library> _libraries, List<Library> libraries) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.gameVersion = gameVersion;
|
this.gameVersion = gameVersion;
|
||||||
this.mainClass = mainClass;
|
this.mainClass = mainClass;
|
||||||
this.fileId = fileId;
|
this.fileId = fileId;
|
||||||
this.tweakers = new ArrayList<>(tweakers);
|
this.tweakers = new ArrayList<>(tweakers);
|
||||||
|
this._libraries = new ArrayList<>(_libraries);
|
||||||
this.libraries = new ArrayList<>(libraries);
|
this.libraries = new ArrayList<>(libraries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +90,7 @@ public final class MultiMCInstancePatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Library> getLibraries() {
|
public List<Library> getLibraries() {
|
||||||
return Collections.unmodifiableList(libraries);
|
return Lang.merge(_libraries, libraries);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user