Skip to content

Commit 6a175e1

Browse files
committed
Extract ModernMinecraftVersionProfile to separate class.
1 parent 37d02c3 commit 6a175e1

File tree

2 files changed

+51
-33
lines changed

2 files changed

+51
-33
lines changed

installer/src/main/kotlin/gg/essential/installer/modloader/ForgeModloader.kt

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -77,39 +77,6 @@ object ForgeModloader : Modloader(ModloaderType.FORGE) {
7777
val libraries: List<ModernMinecraftVersionProfile.Library>? = null,
7878
)
7979

80-
/**
81-
* Represents the json format of the Minecraft launcher's modern version profiles
82-
*
83-
* It does not include the full spec, merely what is (or is thought to be) required by the installer to function
84-
* Due to the missing fields, these should never be serialized to a file directly from these object.
85-
* You should always use the full/raw version profile json provided by the modloader.
86-
*/
87-
@Serializable
88-
data class ModernMinecraftVersionProfile(
89-
val id: MinecraftVersionProfileId,
90-
val inheritsFrom: String,
91-
val releaseTime: String,
92-
val time: String,
93-
val type: String,
94-
val mainClass: String,
95-
val arguments: Arguments,
96-
val libraries: List<Library>,
97-
) {
98-
99-
@Serializable
100-
data class Arguments(val game: List<String>, val jvm: List<String>)
101-
102-
@Serializable
103-
data class Library(val name: String, val downloads: Downloads)
104-
105-
@Serializable
106-
data class Downloads(val artifact: Artifact)
107-
108-
@Serializable
109-
data class Artifact(val path: String? = null, val url: String?, val sha1: String, val size: Long)
110-
111-
}
112-
11380
override fun getMinecraftVersionProfileId(mcVersion: MCVersion, modloaderVersion: ModloaderVersion): MinecraftVersionProfileId {
11481
// Old forge has been very inconsistent with names for versions, this format is how modern versions format it, with "-wrapper" at the end to not mess with normal forge
11582
return "$mcVersion-forge-${modloaderVersion.numeric}-wrapper".replace(Regex("-{2,}"), "-")
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2025 ModCore Inc. All rights reserved.
3+
*
4+
* This code is part of ModCore Inc.’s Essential Installer repository
5+
* and is protected under copyright registration #TX0009446119. For the
6+
* full license, see:
7+
* https://github.com/EssentialGG/EssentialInstaller/blob/main/LICENSE.
8+
*
9+
* You may modify, create, fork, and use new versions of our Essential
10+
* Installer mod in accordance with the GPL-3 License and the additional
11+
* provisions outlined in the LICENSE file. You may not sell, license,
12+
* commercialize, or otherwise exploit the works in this file or any
13+
* other in this repository, all of which is reserved by Essential.
14+
*/
15+
16+
package gg.essential.installer.modloader
17+
18+
import kotlinx.serialization.Serializable
19+
20+
/**
21+
* Represents the json format of the Minecraft launcher's modern version profiles
22+
*
23+
* It does not include the full spec, merely what is (or is thought to be) required by the installer to function
24+
* Due to the missing fields, these should never be serialized to a file directly from these object.
25+
* You should always use the full/raw version profile json provided by the modloader.
26+
*/
27+
@Serializable
28+
data class ModernMinecraftVersionProfile(
29+
val id: MinecraftVersionProfileId,
30+
val inheritsFrom: String,
31+
val releaseTime: String,
32+
val time: String,
33+
val type: String,
34+
val mainClass: String,
35+
val arguments: Arguments,
36+
val libraries: List<Library>,
37+
) {
38+
39+
@Serializable
40+
data class Arguments(val game: List<String>, val jvm: List<String>)
41+
42+
@Serializable
43+
data class Library(val name: String, val downloads: Downloads)
44+
45+
@Serializable
46+
data class Downloads(val artifact: Artifact)
47+
48+
@Serializable
49+
data class Artifact(val path: String? = null, val url: String?, val sha1: String, val size: Long)
50+
51+
}

0 commit comments

Comments
 (0)