Skip to content

Commit 0bf51ce

Browse files
committed
Add full-mod loading support (thanks energy-meters)
1 parent 373add3 commit 0bf51ce

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ run
2525
forge*changelog.txt
2626

2727
logs/
28+
29+
mods/

build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,24 @@ minecraft {
8686
}
8787
}
8888

89+
def format(String jar_name) {
90+
def index = jar_name.lastIndexOf('-')
91+
index = jar_name.substring(0, index).lastIndexOf('-')
92+
def mod_version = jar_name.substring(index).replace(".jar", "")
93+
if (mod_version.startsWith('-')) {
94+
mod_version = mod_version.substring(1);
95+
}
96+
def mod_name = jar_name.substring(0, index)
97+
return mod_name + ":" + mod_name + ":" + mod_version
98+
}
99+
100+
def dev_mods_dir = "mods"
101+
89102
repositories {
103+
flatDir {
104+
dirs dev_mods_dir
105+
}
106+
90107
// location of the maven that hosts JEI files
91108
maven {
92109
name "Progwml Repo"
@@ -100,6 +117,8 @@ repositories {
100117
// }
101118
}
102119

120+
def dev_mods = fileTree(dev_mods_dir).filter { it -> it.isFile() }.files.name.collect( { format(it) } )
121+
103122
dependencies {
104123
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
105124
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
@@ -108,6 +127,12 @@ dependencies {
108127

109128
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2'
110129

130+
// Deobfuscate each dev mod for runtime
131+
dev_mods.each {
132+
compileOnly fg.deobf(it)
133+
runtimeOnly fg.deobf(it)
134+
}
135+
111136
// JEI
112137
// compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
113138
// runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")

0 commit comments

Comments
 (0)