Skip to content

Commit ae87657

Browse files
committed
Implement multiloader support
1 parent 320f788 commit ae87657

33 files changed

+218
-37
lines changed

build.gradle.kts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ group = mod.group
2626
base { archivesName.set(mod.id) }
2727

2828
loom {
29-
splitEnvironmentSourceSets()
30-
31-
mods {
32-
create("template") {
33-
sourceSet(sourceSets["main"])
34-
sourceSet(sourceSets["client"])
35-
}
36-
}
37-
3829
runs {
3930
getByName("client") {
4031
environmentVariable("__GL_THREADED_OPTIMIZATIONS", "0")
@@ -83,29 +74,6 @@ java {
8374
sourceCompatibility = java
8475
}
8576

86-
tasks.processResources {
87-
inputs.property("id", mod.id)
88-
inputs.property("name", mod.name)
89-
inputs.property("version", mod.version)
90-
inputs.property("mcdep", mcDep)
91-
92-
val map = mapOf(
93-
"id" to mod.id,
94-
"name" to mod.name,
95-
"version" to mod.version,
96-
"mcdep" to mcDep
97-
)
98-
99-
filesMatching("fabric.mod.json") { expand(map) }
100-
}
101-
102-
tasks.register<Copy>("buildAndCollect") {
103-
group = "build"
104-
from(tasks.remapJar.get().archiveFile)
105-
into(rootProject.layout.buildDirectory.file("libs/${mod.version}"))
106-
dependsOn("build")
107-
}
108-
10977
/*
11078
publishMods {
11179
file = tasks.remapJar.get().archiveFile

fabric/build.gradle.kts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
plugins {
2+
id("fabric-loom")
3+
}
4+
5+
class ModData {
6+
val id = property("mod.id").toString()
7+
val name = property("mod.name").toString()
8+
val version = property("mod.version").toString()
9+
val group = property("mod.group").toString()
10+
}
11+
12+
val mod = ModData()
13+
val mcVersion = stonecutter.current.version
14+
val mcDep = project(":$mcVersion").property("mod.mc_dep").toString()
15+
16+
version = "${mod.version}+${mcVersion}-fabric"
17+
group = mod.group
18+
base {
19+
archivesName.set(mod.name)
20+
}
21+
22+
dependencies {
23+
minecraft("com.mojang:minecraft:$mcVersion")
24+
mappings(loom.officialMojangMappings())
25+
}
26+
27+
tasks.register<Copy>("buildAndCollect") {
28+
group = "build"
29+
from(tasks.remapJar.get().archiveFile)
30+
into(rootProject.layout.buildDirectory.file("libs/${mod.version}"))
31+
dependsOn("build")
32+
}
33+
34+
tasks.processResources {
35+
inputs.property("id", mod.id)
36+
inputs.property("name", mod.name)
37+
inputs.property("version", mod.version)
38+
inputs.property("mcdep", mcDep)
39+
40+
val map = mapOf(
41+
"id" to mod.id,
42+
"name" to mod.name,
43+
"version" to mod.version,
44+
"mcdep" to mcDep
45+
)
46+
47+
filesMatching("fabric.mod.json") { expand(map) }
48+
}
49+
50+
tasks.jar {
51+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
52+
from(zipTree(project(":$mcVersion").tasks.jar.get().archiveFile))
53+
}

fabric/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod.platform=fabric
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"name": "${name}",
66
"description": "This library adds support for the latest ImGui in a compatible way, while managing all the details of contexts for you.",
77
"authors": [
8-
"IMS212"
8+
"IMS212",
9+
"asojidev",
10+
"BluSpring"
911
],
1012
"contact": {
1113
"sources": "https://github.com/IrisShaders/imgui-mc"

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ mod.mc_targets=[VERSIONED]
2020

2121
# Global dependencies
2222
deps.fabric_loader=0.16.13
23+
deps.imgui_java=1.90.9
2324

25+
# NeoForge
26+
deps.neoforge=[VERSIONED]
27+
28+
# MDG
29+
deps.neoform=[VERSIONED]
2430

2531
# Publishing
2632
publish.modrinth=...

neoforge/build.gradle.kts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
plugins {
2+
id("net.neoforged.moddev") version "2.0.80"
3+
}
4+
5+
class ModData {
6+
val id = property("mod.id").toString()
7+
val name = property("mod.name").toString()
8+
val version = property("mod.version").toString()
9+
val group = property("mod.group").toString()
10+
}
11+
12+
val mod = ModData()
13+
val mcVersion = stonecutter.current.version
14+
val mcDep = property("mod.mc_dep").toString()
15+
16+
version = "${mod.version}+${mcVersion}-neoforge"
17+
group = mod.group
18+
base {
19+
archivesName.set(mod.name)
20+
}
21+
22+
neoForge {
23+
version = property("deps.neoforge").toString()
24+
25+
runs {
26+
create("client") {
27+
client()
28+
}
29+
}
30+
31+
mods {
32+
create("imgui_mc") {
33+
sourceSet(sourceSets.main.get())
34+
}
35+
}
36+
}
37+
38+
tasks.register<Copy>("buildAndCollect") {
39+
group = "build"
40+
from(tasks.jar.get().archiveFile)
41+
into(rootProject.layout.buildDirectory.file("libs/${mod.version}"))
42+
dependsOn("build")
43+
}
44+
45+
tasks.processResources {
46+
inputs.property("id", mod.id)
47+
inputs.property("name", mod.name)
48+
inputs.property("version", mod.version)
49+
inputs.property("mcdep", mcDep)
50+
51+
val map = mapOf(
52+
"id" to mod.id,
53+
"name" to mod.name,
54+
"version" to mod.version,
55+
"mcdep" to mcDep
56+
)
57+
58+
filesMatching("META-INF/mods.toml") { expand(map) }
59+
filesMatching("META-INF/neoforge.mods.toml") { expand(map) }
60+
}
61+
62+
tasks.jar {
63+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
64+
from(zipTree(project(":$mcVersion").tasks.jar.get().archiveFile))
65+
}

neoforge/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod.platform=neoforge
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
modLoader = "javafml"
2+
loaderVersion = "[2,)"
3+
issueTrackerURL = "https://github.com/IrisShaders/imgui-mc/issues"
4+
license = "MIT"
5+
6+
[[mods]]
7+
modId = "${id}"
8+
version = "${version}"
9+
displayName = "${name}"
10+
description = '''This library adds support for the latest ImGui in a compatible way, while managing all the details of contexts for you.'''
11+
authors = "IMS212, asojidev, BluSpring"
12+
displayURL = "https://github.com/IrisShaders/imgui-mc"
13+
14+
[[dependencies.${id}]]
15+
modId = "neoforge"
16+
type = "required"
17+
ordering = "NONE"
18+
side = "BOTH"
19+
20+
[[dependencies.${id}]]
21+
modId = "minecraft"
22+
type = "required"
23+
versionRange = "${mcdep}"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
modLoader = "javafml"
2+
loaderVersion = "[2,)"
3+
issueTrackerURL = "https://github.com/IrisShaders/imgui-mc/issues"
4+
license = "MIT"
5+
6+
[[mods]]
7+
modId = "${id}"
8+
version = "${version}"
9+
displayName = "${name}"
10+
description = '''This library adds support for the latest ImGui in a compatible way, while managing all the details of contexts for you.'''
11+
authors = "IMS212, asojidev, BluSpring"
12+
displayURL = "https://github.com/IrisShaders/imgui-mc"
13+
14+
[[dependencies.${id}]]
15+
modId = "neoforge"
16+
type = "required"
17+
ordering = "NONE"
18+
side = "BOTH"
19+
20+
[[dependencies.${id}]]
21+
modId = "minecraft"
22+
type = "required"
23+
versionRange = "${mcdep}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"pack": {
3+
"description": "${mod_description}",
4+
"pack_format": 17
5+
}
6+
}

0 commit comments

Comments
 (0)