Fix
This commit is contained in:
parent
ff7dddbd35
commit
0ad54e978e
|
@ -40,8 +40,8 @@ public class ListCommand extends Command {
|
|||
continue;
|
||||
}
|
||||
System.out.println(" Status: " + (instance.isRunningLocked() ? "Running" : "Stopped"));
|
||||
System.out.println(" Version: " + instance.meta().getMinecraftVersion());
|
||||
if (instance.isFabric()) System.out.println(" Fabric Loader: " + instance.meta().getLoaderVersion());
|
||||
System.out.println(" Version: " + instance.getGameVersion());
|
||||
if (instance.isFabric()) System.out.println(" Fabric Loader: " + instance.getLoaderVersion());
|
||||
if (instance.meta().java != null) System.out.println(" Custom Java: " + instance.meta().java);
|
||||
if (instance.meta().minMem != null || instance.meta().maxMem != null)
|
||||
System.out.println(" Memory:" + (instance.meta().minMem != null ? " Minimum: " + instance.meta().minMem : "")
|
||||
|
|
|
@ -39,7 +39,7 @@ public class InstanceManageControls {
|
|||
selected = getVersions(false).get(0);
|
||||
if (instance != null) {
|
||||
for (VersionsListInfo ver : getVersions(true)) {
|
||||
if (ver.id.equals(instance.meta().getMinecraftVersion()))
|
||||
if (ver.id.equals(instance.getGameVersion()))
|
||||
selected = ver;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class InstanceManageControls {
|
|||
for (int i = 0, fabricLoaderInfoSize = versions.size(); i < fabricLoaderInfoSize; i++) {
|
||||
FabricVersionLoaderInfo version = versions.get(i);
|
||||
if (instance != null && instance.isFabric()
|
||||
? version.loader.version.equals(instance.meta().getLoaderVersion())
|
||||
? version.loader.version.equals(instance.getLoaderVersion())
|
||||
: version.loader.stable) {
|
||||
selectedFabric = version;
|
||||
fabricVersion.set(i);
|
||||
|
|
|
@ -37,10 +37,10 @@ public class AddModWindow extends Window {
|
|||
String query = this.query.get();
|
||||
new Thread(() -> {
|
||||
try {
|
||||
ModrinthSearchResult ms = ModrinthApi.search(query, mrPage, instance.meta().getMinecraftVersion(), ModrinthProjectType.mod);
|
||||
ModrinthSearchResult ms = ModrinthApi.search(query, mrPage, instance.getGameVersion(), ModrinthProjectType.mod);
|
||||
if (!this.query.get().equals(query)) return;
|
||||
mr = ms;
|
||||
List<CurseforgeMod> cs = CurseforgeApi.search(instance.meta().getMinecraftVersion(), query, cfPage, "Popularity");
|
||||
List<CurseforgeMod> cs = CurseforgeApi.search(instance.getGameVersion(), query, cfPage, "Popularity");
|
||||
if (!this.query.get().equals(query)) return;
|
||||
cf = cs;
|
||||
} catch (IOException e) {
|
||||
|
@ -101,7 +101,7 @@ public class AddModWindow extends Window {
|
|||
ModrinthVersion beta = null;
|
||||
ModrinthVersion latest = null;
|
||||
for (ModrinthVersion version : ModrinthApi.getVersions(mod.project_id)) {
|
||||
if (version.game_versions.contains(instance.meta().getMinecraftVersion()) && version.loaders.contains("fabric")) {
|
||||
if (version.game_versions.contains(instance.getGameVersion()) && version.loaders.contains("fabric")) {
|
||||
latest = version;
|
||||
if (version.version_type == ModrinthVersion.VersionType.beta || version.version_type == ModrinthVersion.VersionType.release) {
|
||||
beta = version;
|
||||
|
@ -174,7 +174,7 @@ public class AddModWindow extends Window {
|
|||
if (ImGui.button("Add##" + mod.id)) {
|
||||
CurseforgeMod.LatestFileIndex latest = null;
|
||||
for (CurseforgeMod.LatestFileIndex file : mod.latestFilesIndexes) {
|
||||
if (file.gameVersion.equals(instance.meta().getMinecraftVersion())) {
|
||||
if (file.gameVersion.equals(instance.getGameVersion())) {
|
||||
if (latest == null) latest = file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class FabricMetaApi {
|
|||
floader.name = ver.intermediary.maven;
|
||||
libs.add(convertLib(floader));
|
||||
result.libraries = List.copyOf(libs);
|
||||
result.id = GameVersionParser.floaderPrefix + fabricVersion + "-" + version.id;
|
||||
result.id = GameVersionParser.createVersionWithFabric(version.id, fabricVersion);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@ import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
|||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Mod;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.source.CurseforgeModSource;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.source.ModSource;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.ModPath;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
@ -26,7 +24,7 @@ public class CurseForgeExporter extends Exporter<CurseforgeModpackManifest> {
|
|||
protected CurseforgeModpackManifest generateManifests(Path root, Instance instance, String version) throws IOException {
|
||||
CurseforgeModpackManifest manifest = new CurseforgeModpackManifest();
|
||||
manifest.minecraft = new CurseforgeModpackManifest.Minecraft();
|
||||
manifest.minecraft.version = instance.meta().getMinecraftVersion();
|
||||
manifest.minecraft.version = instance.getGameVersion();
|
||||
manifest.manifestType = "minecraftModpack";
|
||||
manifest.manifestVersion = 1;
|
||||
manifest.name = instance.getName();
|
||||
|
@ -36,7 +34,7 @@ public class CurseForgeExporter extends Exporter<CurseforgeModpackManifest> {
|
|||
manifest.minecraft.modLoaders = new LinkedHashSet<>();
|
||||
if (instance.isFabric()) {
|
||||
CurseforgeModpackManifest.Minecraft.ModLoader loader = new CurseforgeModpackManifest.Minecraft.ModLoader();
|
||||
loader.id = "fabric-" + instance.meta().getLoaderVersion();
|
||||
loader.id = "fabric-" + instance.getLoaderVersion();
|
||||
loader.primary = true;
|
||||
manifest.minecraft.modLoaders.add(loader);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,7 @@ import io.gitlab.jfronny.inceptum.launcher.model.modrinth.ModrinthModpackManifes
|
|||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Mod;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.source.ModSource;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.source.ModrinthModSource;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.ModPath;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
@ -29,9 +27,9 @@ public class ModrinthExporter extends Exporter<ModrinthModpackManifest> {
|
|||
manifest.name = instance.getName();
|
||||
manifest.files = new ArrayList<>();
|
||||
manifest.dependencies = new ModrinthModpackManifest.Dependencies();
|
||||
manifest.dependencies.minecraft = instance.meta().getMinecraftVersion();
|
||||
manifest.dependencies.minecraft = instance.getGameVersion();
|
||||
if (instance.isFabric()) {
|
||||
manifest.dependencies.fabricLoader = instance.meta().getLoaderVersion();
|
||||
manifest.dependencies.fabricLoader = instance.getLoaderVersion();
|
||||
}
|
||||
JFiles.writeObject(root.resolve("modrinth.index.json"), manifest);
|
||||
return manifest;
|
||||
|
|
|
@ -4,16 +4,12 @@ import io.gitlab.jfronny.commons.io.JFiles;
|
|||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
||||
import io.gitlab.jfronny.inceptum.launcher.model.multimc.MMCPackMeta;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Mod;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.source.ModSource;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.ModPath;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
public class MultiMCExporter extends Exporter<MMCPackMeta> {
|
||||
public MultiMCExporter() {
|
||||
|
@ -61,17 +57,17 @@ public class MultiMCExporter extends Exporter<MMCPackMeta> {
|
|||
MMCPackMeta.Component minecraft = new MMCPackMeta.Component();
|
||||
minecraft.important = true;
|
||||
minecraft.uid = "net.minecraft";
|
||||
minecraft.version = instance.meta().getMinecraftVersion();
|
||||
minecraft.version = instance.getGameVersion();
|
||||
manifest.components.add(minecraft);
|
||||
if (instance.isFabric()) {
|
||||
MMCPackMeta.Component intermediary = new MMCPackMeta.Component();
|
||||
intermediary.dependencyOnly = true;
|
||||
intermediary.uid = "net.fabricmc.intermediary";
|
||||
intermediary.version = instance.meta().getMinecraftVersion();
|
||||
intermediary.version = instance.getGameVersion();
|
||||
manifest.components.add(intermediary);
|
||||
MMCPackMeta.Component fabric = new MMCPackMeta.Component();
|
||||
fabric.uid = "net.fabricmc.fabric-loader";
|
||||
fabric.version = instance.meta().getLoaderVersion();
|
||||
fabric.version = instance.getLoaderVersion();
|
||||
manifest.components.add(fabric);
|
||||
}
|
||||
JFiles.writeObject(root.resolve("mmc-pack.json"), manifest);
|
||||
|
|
|
@ -41,7 +41,7 @@ public abstract class Importer<T> {
|
|||
return gameVersion;
|
||||
} else {
|
||||
FabricMetaApi.getLoaderVersion(gameVersion, fabricVersion);
|
||||
return GameVersionParser.floaderPrefix + fabricVersion + '-' + gameVersion;
|
||||
return GameVersionParser.createVersionWithFabric(gameVersion, fabricVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ public record Instance(String id, Path path, InstanceMeta meta, ModsDirScanner m
|
|||
return GameVersionParser.isFabric(meta.version);
|
||||
}
|
||||
|
||||
public String getMinecraftVersion() {
|
||||
return GameVersionParser.getMinecraftVersion(meta.version);
|
||||
public String getGameVersion() {
|
||||
return GameVersionParser.getGameVersion(meta.version);
|
||||
}
|
||||
|
||||
public String getLoaderVersion() {
|
||||
|
|
|
@ -59,11 +59,11 @@ public class InstanceLauncher {
|
|||
|
||||
public static void launch(Instance instance, LaunchType launchType, boolean restart, AuthInfo authInfo) throws LaunchException, IOException {
|
||||
if (authInfo == null) throw new LaunchException("authInfo is null");
|
||||
VersionsListInfo versionDataSimple = getVersion(instance.meta().getMinecraftVersion());
|
||||
VersionsListInfo versionDataSimple = getVersion(instance.getGameVersion());
|
||||
VersionInfo versionInfo = McApi.getVersionInfo(versionDataSimple);
|
||||
// Add fabric metadata if using fabric
|
||||
if (instance.isFabric()) {
|
||||
versionInfo = FabricMetaApi.addFabric(versionInfo, instance.meta().getLoaderVersion(), launchType.fabricMetaType);
|
||||
versionInfo = FabricMetaApi.addFabric(versionInfo, instance.getLoaderVersion(), launchType.fabricMetaType);
|
||||
}
|
||||
// Ensure libs/assets are present
|
||||
DownloadLibrariesStep.execute(versionInfo, new AtomicBoolean(false), new ProcessState());
|
||||
|
@ -220,7 +220,7 @@ public class InstanceLauncher {
|
|||
return arg
|
||||
// game args
|
||||
.replace("${auth_player_name}", authInfo.name())
|
||||
.replace("${version_name}", instance.meta().getMinecraftVersion())
|
||||
.replace("${version_name}", instance.getGameVersion())
|
||||
.replace("${game_directory}", instance.path().toString())
|
||||
.replace("${assets_root}", MetaHolder.ASSETS_DIR.toAbsolutePath().toString())
|
||||
.replace("${assets_index_name}", info.assets)
|
||||
|
@ -231,7 +231,7 @@ public class InstanceLauncher {
|
|||
.replace("${resolution_width}", "1920") //TODO has_custom_resolution
|
||||
.replace("${resolution_height}", "1080") //TODO has_custom_resolution
|
||||
// jvm args
|
||||
.replace("${natives_directory}", MetaHolder.NATIVES_DIR.resolve(instance.meta().getMinecraftVersion()).toAbsolutePath().toString())
|
||||
.replace("${natives_directory}", MetaHolder.NATIVES_DIR.resolve(instance.getGameVersion()).toAbsolutePath().toString())
|
||||
.replace("${launcher_name}", "Inceptum")
|
||||
.replace("${launcher_version}", BuildMetadata.VERSION.toString())
|
||||
.replace("${classpath}", classPath)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package io.gitlab.jfronny.inceptum.launcher.system.mds;
|
||||
|
||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Mod;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.mds.noop.NoopMds;
|
||||
import io.gitlab.jfronny.inceptum.launcher.util.GameVersionParser;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
@ -15,7 +15,7 @@ import java.util.function.BiConsumer;
|
|||
public interface ModsDirScanner extends Closeable {
|
||||
static ModsDirScanner get(Path modsDir, InstanceMeta meta) throws IOException {
|
||||
if (Files.exists(modsDir)) return ModsDirScannerImpl.get(modsDir, meta);
|
||||
return new NoopMds(meta.getMinecraftVersion());
|
||||
return new NoopMds(GameVersionParser.getGameVersion(meta.version));
|
||||
}
|
||||
|
||||
static void closeAll() {
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.gitlab.jfronny.inceptum.common.Utils;
|
|||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.*;
|
||||
import io.gitlab.jfronny.inceptum.launcher.system.mds.noop.NoopMod;
|
||||
import io.gitlab.jfronny.inceptum.launcher.util.GameVersionParser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.*;
|
||||
|
@ -65,7 +66,7 @@ class ModsDirScannerImpl implements ModsDirScanner {
|
|||
|
||||
@Override
|
||||
public String getGameVersion() {
|
||||
return instance.meta.getMinecraftVersion();
|
||||
return GameVersionParser.getGameVersion(instance.meta.version);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,7 +113,6 @@ class ModsDirScannerImpl implements ModsDirScanner {
|
|||
return;
|
||||
}
|
||||
Set<Future<?>> tasks = new HashSet<>();
|
||||
String mc = instance.meta.getMinecraftVersion();
|
||||
discovered = discovered.andThen((path, iwModDescription) -> {
|
||||
scannedPaths.add(path);
|
||||
descriptions.put(path, iwModDescription);
|
||||
|
@ -137,7 +137,7 @@ class ModsDirScannerImpl implements ModsDirScanner {
|
|||
});
|
||||
}
|
||||
for (Path p : toScan) {
|
||||
tasks.add(POOL.submit(new FileScanTask(instance, p, discovered, mc)));
|
||||
tasks.add(POOL.submit(new FileScanTask(instance, p, discovered, getGameVersion())));
|
||||
}
|
||||
for (Future<?> task : tasks) {
|
||||
try {
|
||||
|
|
|
@ -32,13 +32,13 @@ public class Steps {
|
|||
if (instance.isLocked()) return;
|
||||
boolean found = false;
|
||||
for (VersionsListInfo version : McApi.getVersions().versions) {
|
||||
if (version.id.equals(instance.meta().getMinecraftVersion())) {
|
||||
if (version.id.equals(instance.getGameVersion())) {
|
||||
found = true;
|
||||
VersionInfo vi = McApi.getVersionInfo(version);
|
||||
if (instance.isFabric())
|
||||
vi = FabricMetaApi.addFabric(vi, instance.meta().getLoaderVersion(), FabricMetaApi.FabricVersionInfoType.Both);
|
||||
vi = FabricMetaApi.addFabric(vi, instance.getLoaderVersion(), FabricMetaApi.FabricVersionInfoType.Both);
|
||||
LoaderInfo li = instance.isFabric()
|
||||
? new LoaderInfo(LoaderInfo.Type.Fabric, instance.meta().getLoaderVersion())
|
||||
? new LoaderInfo(LoaderInfo.Type.Fabric, instance.getLoaderVersion())
|
||||
: LoaderInfo.NONE;
|
||||
SetupStepInfo info = new SetupStepInfo(vi, li, instance.getName(), state);
|
||||
for (Step step : Steps.STEPS) {
|
||||
|
@ -47,6 +47,6 @@ public class Steps {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!found) throw new IOException("Could not identify minecraft version " + instance.meta().getMinecraftVersion());
|
||||
if (!found) throw new IOException("Could not identify minecraft version " + instance.getGameVersion());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class DownloadClientStep implements Step {
|
|||
Path serverPath = MetaHolder.LIBRARIES_DIR.resolve("net/minecraft/server");
|
||||
if (!Files.exists(clientPath)) Files.createDirectories(clientPath);
|
||||
if (!Files.exists(serverPath)) Files.createDirectories(serverPath);
|
||||
String minecraftVersion = GameVersionParser.getMinecraftVersion(info.version().id);
|
||||
String minecraftVersion = GameVersionParser.getGameVersion(info.version().id);
|
||||
clientPath = clientPath.resolve(minecraftVersion + ".jar");
|
||||
serverPath = serverPath.resolve(minecraftVersion + ".jar");
|
||||
try {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DownloadLibrariesStep implements Step {
|
|||
if (artifact.isNative) {
|
||||
currentState.updateStep("Extracting natives");
|
||||
try (FileSystem libFs = Utils.openZipFile(path, false)) {
|
||||
JFiles.copyRecursive(libFs.getPath("."), MetaHolder.NATIVES_DIR.resolve(GameVersionParser.getMinecraftVersion(version.id)));
|
||||
JFiles.copyRecursive(libFs.getPath("."), MetaHolder.NATIVES_DIR.resolve(GameVersionParser.getGameVersion(version.id)));
|
||||
} catch (Throwable t) {
|
||||
Files.delete(path);
|
||||
throw new IOException("Could not extract native", t);
|
||||
|
|
|
@ -33,6 +33,6 @@ public class SetupDirsStep implements Step {
|
|||
if (!Files.exists(eulaTxt)) {
|
||||
Files.writeString(eulaTxt, "eula=true");
|
||||
}
|
||||
Files.createDirectories(MetaHolder.NATIVES_DIR.resolve(GameVersionParser.getMinecraftVersion(info.version().id)));
|
||||
Files.createDirectories(MetaHolder.NATIVES_DIR.resolve(GameVersionParser.getGameVersion(info.version().id)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,15 @@ public class GameVersionParser {
|
|||
return version.startsWith(FABRIC_PREFIX);
|
||||
}
|
||||
|
||||
public static String getMinecraftVersion(String version) {
|
||||
public static String getGameVersion(String version) {
|
||||
return version.startsWith(FABRIC_PREFIX) ? version.substring(version.lastIndexOf('-') + 1) : version;
|
||||
}
|
||||
|
||||
public static String getLoaderVersion(String version) {
|
||||
return !isFabric(version) ? null : version.substring(FABRIC_PREFIX.length(), version.lastIndexOf('-'));
|
||||
}
|
||||
|
||||
public static String createVersionWithFabric(String gameVersion, String fabricVersion) {
|
||||
return FABRIC_PREFIX + fabricVersion + '-' + gameVersion;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue