@@ -10,9 +10,12 @@ import xyz.wagyourtail.patchbase.gradle.tasks.CreateSourcePatchTask
10
10
import xyz.wagyourtail.unimined.api.minecraft.EnvType
11
11
import xyz.wagyourtail.unimined.api.minecraft.MinecraftConfig
12
12
import xyz.wagyourtail.unimined.api.unimined
13
+ import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider
13
14
import xyz.wagyourtail.unimined.internal.minecraft.patch.jarmod.JarModAgentMinecraftTransformer
14
15
import xyz.wagyourtail.unimined.util.withSourceSet
16
+ import kotlin.io.path.nameWithoutExtension
15
17
18
+ @Suppress(" UnstableApiUsage" )
16
19
abstract class PatchExtension (val project : Project ) {
17
20
18
21
fun patchBaseCreator (sourceSet : SourceSet ) {
@@ -27,11 +30,13 @@ abstract class PatchExtension(val project: Project) {
27
30
project.logger.warn(" [PatchBase/Creator ${this .project.path} ${sourceSet} ] mcPatcher is not a JarModAgentMinecraftTransformer, this may cause issues with dev runs" )
28
31
}
29
32
33
+ val mcp = mc as MinecraftProvider // needed for access to `getMcDevFile()`
34
+
30
35
project.tasks.register(" createSourcePatch" .withSourceSet(sourceSet), CreateSourcePatchTask ::class .java) {
31
36
it.group = " patchbase"
32
37
it.sourceDir.set(project.file(" src/${sourceSet.name} /java" ))
33
38
it.outputDir.set(project.file(" patches/${sourceSet.name} " ))
34
- val sourceFile = mc.minecraftFileDev.resolveSibling(mc.minecraftFileDev .nameWithoutExtension + " -sources.jar" )
39
+ val sourceFile = mc.minecraftFileDev.resolveSibling(mcp.getMcDevFile() .nameWithoutExtension + " -sources.jar" )
35
40
it.sources.set(project.files(sourceFile))
36
41
if (! sourceFile.exists()) {
37
42
it.dependsOn(" genSources" )
@@ -42,7 +47,7 @@ abstract class PatchExtension(val project: Project) {
42
47
it.group = " patchbase"
43
48
it.patchDir.set(project.file(" patches/${sourceSet.name} " ))
44
49
it.outputDir.set(project.file(" src/${sourceSet.name} /java" ))
45
- val sourceFile = mc.minecraftFileDev.resolveSibling(mc.minecraftFileDev .nameWithoutExtension + " -sources.jar" )
50
+ val sourceFile = mc.minecraftFileDev.resolveSibling(mcp.getMcDevFile() .nameWithoutExtension + " -sources.jar" )
46
51
it.sources.set(project.files(sourceFile))
47
52
if (! sourceFile.exists()) {
48
53
it.dependsOn(" genSources" .withSourceSet(sourceSet))
@@ -56,9 +61,7 @@ abstract class PatchExtension(val project: Project) {
56
61
when (mc.side) {
57
62
EnvType .CLIENT -> it.classpath.set(project.files(mc.minecraftData.minecraftClientFile))
58
63
EnvType .SERVER -> it.classpath.set(project.files(mc.minecraftData.minecraftServerFile))
59
- EnvType .COMBINED -> {
60
- it.classpath.set(project.files(mc.mergedOfficialMinecraftFile))
61
- }
64
+ EnvType .COMBINED -> it.classpath.set(project.files(mc.mergedOfficialMinecraftFile))
62
65
else -> throw IllegalStateException (" Unknown side: ${mc.side} " )
63
66
}
64
67
0 commit comments