feat: support NeoForge loader for Modrinth and MultiMC import
This commit is contained in:
parent
74005bdbe9
commit
3ea69265b8
6 changed files with 83 additions and 9 deletions
|
@ -6,11 +6,11 @@ This changelog only contains the changes that are unreleased. For changes for in
|
||||||
## 3.4.31.3
|
## 3.4.31.3
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
|
||||||
- Servers will now be started using kitty, allacritty or gnome-terminal, if x-terminal-emulator or exo-open aren't present
|
- Servers will now be started using kitty, allacritty or gnome-terminal, if x-terminal-emulator or exo-open aren't present
|
||||||
- Rename "Vanilla Packs" to "Create Pack"
|
- Support NeoForge loader for Modrinth and MultiMC import
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
- Organize ViewModels
|
- Organize ViewModels
|
||||||
|
- Rename "Vanilla Packs" to "Create Pack"
|
|
@ -1798,7 +1798,7 @@ public class Instance extends MinecraftVersion {
|
||||||
manifest.components.add(minecraftComponent);
|
manifest.components.add(minecraftComponent);
|
||||||
|
|
||||||
// fabric loader
|
// fabric loader
|
||||||
if (launcher.loaderVersion.type.equals("Fabric") || launcher.loaderVersion.type.equals("LegacyFabric")) {
|
if (launcher.loaderVersion.isFabric() || launcher.loaderVersion.isLegacyFabric()) {
|
||||||
// mappings
|
// mappings
|
||||||
MultiMCComponent fabricMappingsComponent = new MultiMCComponent();
|
MultiMCComponent fabricMappingsComponent = new MultiMCComponent();
|
||||||
fabricMappingsComponent.cachedName = "Intermediary Mappings";
|
fabricMappingsComponent.cachedName = "Intermediary Mappings";
|
||||||
|
@ -1832,7 +1832,25 @@ public class Instance extends MinecraftVersion {
|
||||||
}
|
}
|
||||||
|
|
||||||
// forge loader
|
// forge loader
|
||||||
if (launcher.loaderVersion.type.equals("Forge")) {
|
if (launcher.loaderVersion.isNeoForge()) {
|
||||||
|
// loader
|
||||||
|
MultiMCComponent forgeMappingsComponent = new MultiMCComponent();
|
||||||
|
forgeMappingsComponent.cachedName = "Forge";
|
||||||
|
|
||||||
|
forgeMappingsComponent.cachedRequires = new ArrayList<>();
|
||||||
|
MultiMCRequire minecraftRequire = new MultiMCRequire();
|
||||||
|
minecraftRequire.equals = id;
|
||||||
|
minecraftRequire.uid = "net.minecraft";
|
||||||
|
forgeMappingsComponent.cachedRequires.add(minecraftRequire);
|
||||||
|
|
||||||
|
forgeMappingsComponent.cachedVersion = launcher.loaderVersion.version;
|
||||||
|
forgeMappingsComponent.uid = "net.neoforged";
|
||||||
|
forgeMappingsComponent.version = launcher.loaderVersion.version;
|
||||||
|
manifest.components.add(forgeMappingsComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// forge loader
|
||||||
|
if (launcher.loaderVersion.isForge()) {
|
||||||
// loader
|
// loader
|
||||||
MultiMCComponent forgeMappingsComponent = new MultiMCComponent();
|
MultiMCComponent forgeMappingsComponent = new MultiMCComponent();
|
||||||
forgeMappingsComponent.cachedName = "Forge";
|
forgeMappingsComponent.cachedName = "Forge";
|
||||||
|
@ -1850,7 +1868,7 @@ public class Instance extends MinecraftVersion {
|
||||||
}
|
}
|
||||||
|
|
||||||
// quilt loader
|
// quilt loader
|
||||||
if (launcher.loaderVersion.type.equals("Quilt")) {
|
if (launcher.loaderVersion.isQuilt()) {
|
||||||
String hashedName = "org.quiltmc.hashed";
|
String hashedName = "org.quiltmc.hashed";
|
||||||
String cachedName = "Hashed Mappings";
|
String cachedName = "Hashed Mappings";
|
||||||
if (ConfigManager.getConfigItem("loaders.quilt.switchHashedForIntermediary", true) == false) {
|
if (ConfigManager.getConfigItem("loaders.quilt.switchHashedForIntermediary", true) == false) {
|
||||||
|
|
|
@ -128,6 +128,10 @@ public class LoaderVersion {
|
||||||
return "quilt-loader";
|
return "quilt-loader";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isNeoForge()) {
|
||||||
|
return "neoforge";
|
||||||
|
}
|
||||||
|
|
||||||
return "forge";
|
return "forge";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -776,6 +776,7 @@ public class InstanceInstallerDialog extends JDialog {
|
||||||
|
|
||||||
packVersion.hasLoader = modrinthManifest.dependencies.containsKey("fabric-loader")
|
packVersion.hasLoader = modrinthManifest.dependencies.containsKey("fabric-loader")
|
||||||
|| modrinthManifest.dependencies.containsKey("quilt-loader")
|
|| modrinthManifest.dependencies.containsKey("quilt-loader")
|
||||||
|
|| modrinthManifest.dependencies.containsKey("neoforge")
|
||||||
|| modrinthManifest.dependencies.containsKey("forge");
|
|| modrinthManifest.dependencies.containsKey("forge");
|
||||||
|
|
||||||
pack.versions = Collections.singletonList(packVersion);
|
pack.versions = Collections.singletonList(packVersion);
|
||||||
|
@ -812,7 +813,8 @@ public class InstanceInstallerDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
packVersion.hasLoader = multiMCManifest.components.stream()
|
packVersion.hasLoader = multiMCManifest.components.stream()
|
||||||
.anyMatch(c -> c.uid.equalsIgnoreCase("net.minecraftforge")
|
.anyMatch(c -> c.uid.equalsIgnoreCase("net.neoforged")
|
||||||
|
|| c.uid.equalsIgnoreCase("net.minecraftforge")
|
||||||
|| c.uid.equalsIgnoreCase("net.fabricmc.hashed"));
|
|| c.uid.equalsIgnoreCase("net.fabricmc.hashed"));
|
||||||
|
|
||||||
pack.versions = Collections.singletonList(packVersion);
|
pack.versions = Collections.singletonList(packVersion);
|
||||||
|
|
|
@ -117,6 +117,7 @@ import com.atlauncher.data.technic.TechnicModpackAsset;
|
||||||
import com.atlauncher.data.technic.TechnicSolderModpackManifest;
|
import com.atlauncher.data.technic.TechnicSolderModpackManifest;
|
||||||
import com.atlauncher.exceptions.LocalException;
|
import com.atlauncher.exceptions.LocalException;
|
||||||
import com.atlauncher.graphql.GetForgeLoaderVersionQuery;
|
import com.atlauncher.graphql.GetForgeLoaderVersionQuery;
|
||||||
|
import com.atlauncher.graphql.GetNeoForgeLoaderVersionQuery;
|
||||||
import com.atlauncher.gui.dialogs.BrowserDownloadDialog;
|
import com.atlauncher.gui.dialogs.BrowserDownloadDialog;
|
||||||
import com.atlauncher.interfaces.NetworkProgressable;
|
import com.atlauncher.interfaces.NetworkProgressable;
|
||||||
import com.atlauncher.managers.ConfigManager;
|
import com.atlauncher.managers.ConfigManager;
|
||||||
|
@ -1620,6 +1621,7 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
||||||
|
|
||||||
if (modrinthManifest.dependencies.containsKey("fabric-loader")
|
if (modrinthManifest.dependencies.containsKey("fabric-loader")
|
||||||
|| modrinthManifest.dependencies.containsKey("quilt-loader")
|
|| modrinthManifest.dependencies.containsKey("quilt-loader")
|
||||||
|
|| modrinthManifest.dependencies.containsKey("neoforge")
|
||||||
|| modrinthManifest.dependencies.containsKey("forge")) {
|
|| modrinthManifest.dependencies.containsKey("forge")) {
|
||||||
packVersion.loader = new com.atlauncher.data.json.Loader();
|
packVersion.loader = new com.atlauncher.data.json.Loader();
|
||||||
|
|
||||||
|
@ -1641,6 +1643,29 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
||||||
loaderMeta.put("loader", modrinthManifest.dependencies.get("quilt-loader"));
|
loaderMeta.put("loader", modrinthManifest.dependencies.get("quilt-loader"));
|
||||||
packVersion.loader.metadata = loaderMeta;
|
packVersion.loader.metadata = loaderMeta;
|
||||||
packVersion.loader.className = "com.atlauncher.data.minecraft.loaders.quilt.QuiltLoader";
|
packVersion.loader.className = "com.atlauncher.data.minecraft.loaders.quilt.QuiltLoader";
|
||||||
|
} else if (modrinthManifest.dependencies.containsKey("neoforge")) {
|
||||||
|
String neoForgeVersionString = modrinthManifest.dependencies.get("neoforge");
|
||||||
|
|
||||||
|
if (ConfigManager.getConfigItem("useGraphql.loaderVersions", false) == false) {
|
||||||
|
throw new Exception(
|
||||||
|
"Failed to find loader version for " + neoForgeVersionString + " as GraphQL is disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
GetNeoForgeLoaderVersionQuery.Data response = GraphqlClient
|
||||||
|
.callAndWait(new GetNeoForgeLoaderVersionQuery(neoForgeVersionString));
|
||||||
|
|
||||||
|
if (response == null || response.neoForgeVersion() == null) {
|
||||||
|
throw new Exception("Failed to find loader version for " + neoForgeVersionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> loaderMeta = new HashMap<>();
|
||||||
|
loaderMeta.put("minecraft", packVersion.minecraft);
|
||||||
|
|
||||||
|
loaderMeta.put("version", response.neoForgeVersion().version());
|
||||||
|
loaderMeta.put("rawVersion", response.neoForgeVersion().rawVersion());
|
||||||
|
|
||||||
|
packVersion.loader.metadata = loaderMeta;
|
||||||
|
packVersion.loader.className = "com.atlauncher.data.minecraft.loaders.neoforge.NeoForgeLoader";
|
||||||
} else if (modrinthManifest.dependencies.containsKey("forge")) {
|
} else if (modrinthManifest.dependencies.containsKey("forge")) {
|
||||||
String forgeVersionString = modrinthManifest.dependencies.get("forge");
|
String forgeVersionString = modrinthManifest.dependencies.get("forge");
|
||||||
|
|
||||||
|
@ -1756,6 +1781,8 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
||||||
|
|
||||||
packVersion.loader = new com.atlauncher.data.json.Loader();
|
packVersion.loader = new com.atlauncher.data.json.Loader();
|
||||||
|
|
||||||
|
MultiMCComponent neoForgedComponent = multiMCManifest.components.stream()
|
||||||
|
.filter(c -> c.uid.equalsIgnoreCase("net.neoforged")).findFirst().orElse(null);
|
||||||
MultiMCComponent forgeComponent = multiMCManifest.components.stream()
|
MultiMCComponent forgeComponent = multiMCManifest.components.stream()
|
||||||
.filter(c -> c.uid.equalsIgnoreCase("net.minecraftforge")).findFirst().orElse(null);
|
.filter(c -> c.uid.equalsIgnoreCase("net.minecraftforge")).findFirst().orElse(null);
|
||||||
MultiMCComponent fabricLoaderComponent = multiMCManifest.components.stream()
|
MultiMCComponent fabricLoaderComponent = multiMCManifest.components.stream()
|
||||||
|
@ -1763,7 +1790,30 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
||||||
MultiMCComponent quiltLoaderComponent = multiMCManifest.components.stream()
|
MultiMCComponent quiltLoaderComponent = multiMCManifest.components.stream()
|
||||||
.filter(c -> c.uid.equalsIgnoreCase("org.quiltmc.quilt-loader")).findFirst().orElse(null);
|
.filter(c -> c.uid.equalsIgnoreCase("org.quiltmc.quilt-loader")).findFirst().orElse(null);
|
||||||
|
|
||||||
if (forgeComponent != null) {
|
if (neoForgedComponent != null) {
|
||||||
|
String neoForgeVersionString = neoForgedComponent.version;
|
||||||
|
|
||||||
|
if (ConfigManager.getConfigItem("useGraphql.loaderVersions", false) == false) {
|
||||||
|
throw new Exception(
|
||||||
|
"Failed to find loader version for " + neoForgeVersionString + " as GraphQL is disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
GetNeoForgeLoaderVersionQuery.Data response = GraphqlClient
|
||||||
|
.callAndWait(new GetNeoForgeLoaderVersionQuery(neoForgeVersionString));
|
||||||
|
|
||||||
|
if (response == null || response.neoForgeVersion() == null) {
|
||||||
|
throw new Exception("Failed to find loader version for " + neoForgeVersionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> loaderMeta = new HashMap<>();
|
||||||
|
loaderMeta.put("minecraft", minecraftVersion);
|
||||||
|
|
||||||
|
loaderMeta.put("version", response.neoForgeVersion().version());
|
||||||
|
loaderMeta.put("rawVersion", response.neoForgeVersion().rawVersion());
|
||||||
|
|
||||||
|
packVersion.loader.metadata = loaderMeta;
|
||||||
|
packVersion.loader.className = "com.atlauncher.data.minecraft.loaders.neoforge.NeoForgeLoader";
|
||||||
|
} else if (forgeComponent != null) {
|
||||||
String forgeVersionString = forgeComponent.version;
|
String forgeVersionString = forgeComponent.version;
|
||||||
|
|
||||||
if (ConfigManager.getConfigItem("useGraphql.loaderVersions", false) == true) {
|
if (ConfigManager.getConfigItem("useGraphql.loaderVersions", false) == true) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
3.4.31.3.Beta
|
3.4.32.0.Beta
|
||||||
|
|
Loading…
Reference in a new issue