1
1
plugins
2
2
{
3
- id ' eclipse'
4
- id ' idea'
5
- id ' maven-publish'
6
- id ' net.minecraftforge.gradle' version ' [6.0,6.2)'
3
+ id ' eclipse'
4
+ id ' idea'
5
+ id ' maven-publish'
6
+ id ' net.minecraftforge.gradle' version ' [6.0.16 ,6.2)'
7
7
id ' org.spongepowered.mixin' version ' 0.7.+'
8
8
}
9
9
@@ -20,47 +20,29 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
20
20
println " Java: ${ System.getProperty 'java.version'} , JVM: ${ System.getProperty 'java.vm.version'} (${ System.getProperty 'java.vendor'} ), Arch: ${ System.getProperty 'os.arch'} "
21
21
minecraft
22
22
{
23
- mappings channel : mapping_channel, version : mapping_version
24
- copyIdeResources = true
23
+ mappings channel : mapping_channel, version : mapping_version
24
+ copyIdeResources = true
25
25
26
- runs
26
+ runs
27
27
{
28
- client
28
+ configureEach
29
29
{
30
- workingDirectory project. file(' run' )
31
-
32
- property ' forge.logging.markers' , ' REGISTRIES'
33
- property ' forge.logging.console.level' , ' debug'
34
- property ' forge.enabledGameTestNamespaces' , mod_id
35
-
36
- mods
37
- {
38
- " ${ mod_id} " { source sourceSets. main }
39
- }
40
- }
41
-
42
- server
43
- {
44
- workingDirectory project. file(' run' )
45
-
46
- property ' forge.logging.markers' , ' REGISTRIES'
47
- property ' forge.logging.console.level' , ' debug'
48
- property ' forge.enabledGameTestNamespaces' , mod_id
49
-
50
- mods
51
- {
52
- " ${ mod_id} " { source sourceSets. main }
53
- }
54
- }
55
- }
30
+ workingDirectory project. file(' run' )
31
+ property ' forge.logging.markers' , ' REGISTRIES'
32
+ property ' forge.logging.console.level' , ' debug'
33
+ }
34
+
35
+ client { property ' forge.enabledGameTestNamespaces' , mod_id }
36
+ server { property ' forge.enabledGameTestNamespaces' , mod_id }
37
+ }
56
38
}
57
39
58
40
sourceSets. main. resources { srcDir ' src/generated/resources' }
59
41
60
42
dependencies
61
43
{
62
- minecraft " net.minecraftforge:forge:${ minecraft_version} -${ forge_version} "
63
- annotationProcessor ' org.spongepowered:mixin:0.8.5:processor'
44
+ minecraft " net.minecraftforge:forge:${ minecraft_version} -${ forge_version} "
45
+ annotationProcessor ' org.spongepowered:mixin:0.8.5:processor'
64
46
}
65
47
66
48
mixin
@@ -69,41 +51,46 @@ mixin
69
51
config " mixins.${ mod_id} .json"
70
52
}
71
53
72
- def resourceTargets = [' META-INF/mods.toml' , ' pack.mcmeta' ]
73
- def replaceProperties =
74
- [
75
- minecraft_version : minecraft_version, minecraft_version_range : minecraft_version_range,
76
- forge_version : forge_version, forge_version_range : forge_version_range,
77
- loader_version_range : loader_version_range,
78
- mod_id : mod_id, mod_name : mod_name, mod_license : mod_license, mod_version : mod_version,
79
- mod_authors : mod_authors, mod_description : mod_description,
80
- mod_url : mod_url, mod_issues : mod_issues, mod_credits : mod_credits
81
- ]
82
-
83
- processResources
54
+ tasks. named(' processResources' , ProcessResources ). configure
84
55
{
85
- inputs. properties replaceProperties
86
- replaceProperties. put ' project' , project
56
+ var replaceProperties =
57
+ [
58
+ minecraft_version : minecraft_version, minecraft_version_range : minecraft_version_range,
59
+ forge_version : forge_version, forge_version_range : forge_version_range,
60
+ loader_version_range : loader_version_range,
61
+ mod_id : mod_id, mod_name : mod_name, mod_license : mod_license, mod_version : mod_version,
62
+ mod_authors : mod_authors, mod_description : mod_description,
63
+ mod_url : mod_url, mod_issues : mod_issues, mod_credits : mod_credits
64
+ ]
65
+ inputs. properties replaceProperties
87
66
88
- filesMatching(resourceTargets ) { expand replaceProperties }
67
+ filesMatching([ ' META-INF/mods.toml ' , ' pack.mcmeta ' ] ) { expand replaceProperties + [ project : project] }
89
68
}
90
69
91
- jar
70
+ tasks . named( ' jar' , Jar ) . configure
92
71
{
93
- manifest
72
+ manifest
94
73
{
95
- attributes([
96
- " Specification-Title" : mod_id,
97
- " Specification-Vendor" : mod_authors,
98
- " Specification-Version" : " 1" ,
99
- " Implementation-Title" : project. name,
100
- " Implementation-Version" : project. jar. archiveVersion,
101
- " Implementation-Vendor" : mod_authors,
102
- " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
103
- ])
104
- }
74
+ attributes([
75
+ ' Specification-Title' : mod_id,
76
+ ' Specification-Vendor' : mod_authors,
77
+ ' Specification-Version' : ' 1' ,
78
+ ' Implementation-Title' : project. name,
79
+ ' Implementation-Version' : project. jar. archiveVersion,
80
+ ' Implementation-Vendor' : mod_authors
81
+ ])
82
+ }
83
+
84
+ finalizedBy ' reobfJar'
105
85
}
106
86
107
- jar. finalizedBy(' reobfJar' )
108
-
109
87
tasks. withType(JavaCompile ). configureEach { options. encoding = ' UTF-8' }
88
+
89
+ eclipse { synchronizationTasks ' genEclipseRuns' }
90
+
91
+ sourceSets. each
92
+ {
93
+ def dir = layout. buildDirectory. dir(" sourcesSets/$it . name " )
94
+ it. output. resourcesDir = dir
95
+ it. java. destinationDirectory = dir
96
+ }
0 commit comments