1
1
buildscript {
2
2
repositories {
3
- maven { url = ' https://files.minecraftforge.net/maven' }
3
+ maven { url(" https://files.minecraftforge.net/maven" ) }
4
+ maven { url(" https://libraries.minecraft.net" ) }
5
+ maven { url(" https://plugins.gradle.org/m2/" ) }
4
6
jcenter()
5
7
mavenCentral()
6
8
}
7
9
dependencies {
8
- classpath group : ' net.minecraftforge.gradle' , name : ' ForgeGradle' , version : ' 3.+' , changing : true
10
+ classpath(
11
+ group : " net.minecraftforge.gradle" ,
12
+ name : " ForgeGradle" ,
13
+ version : forgeGradleVersion,
14
+ changing : true
15
+ )
16
+ classpath(
17
+ " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion "
18
+ )
19
+ classpath(
20
+ " org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion "
21
+ )
22
+ classpath (
23
+ " org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion "
24
+ )
9
25
}
10
26
}
11
- apply plugin : ' net.minecraftforge.gradle'
12
- // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
13
- apply plugin : ' eclipse'
14
- apply plugin : ' maven-publish'
15
27
16
- version = ' 1.0'
17
- group = ' com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
18
- archivesBaseName = ' modid'
28
+ apply(plugin : " org.jetbrains.dokka" )
29
+ apply(plugin : " net.minecraftforge.gradle" )
30
+ apply(plugin : " kotlin" )
31
+ apply(plugin : " java" )
32
+ apply(plugin : " kotlinx-serialization" )
19
33
20
- sourceCompatibility = targetCompatibility = compileJava. sourceCompatibility = compileJava. targetCompatibility = ' 1.8' // Need this here so eclipse task generates correctly.
34
+ version = projectEssentialsVersion
35
+ group = " com.mairwunnx.$projectEssentialsId "
36
+ archivesBaseName = projectEssentialsName
37
+
38
+ configurations {
39
+ modClientDependencies
40
+ modServerDependencies
41
+ }
21
42
22
43
minecraft {
23
- // The mappings can be changed at any time, and must be in the following format.
24
- // snapshot_YYYYMMDD Snapshot are built nightly.
25
- // stable_# Stables are built at the discretion of the MCP team.
26
- // Use non-default mappings at your own risk. they may not always work.
27
- // Simply re-run your setup task after changing the mappings to update your workspace.
28
- mappings channel : ' snapshot' , version : ' 20190719-1.14.3'
29
- // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
30
-
31
- // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
32
-
33
- // Default run configurations.
34
- // These can be tweaked, removed, or duplicated as needed.
44
+ mappings(
45
+ channel : mappingsChannelType,
46
+ version : mappingsChannelVersion
47
+ )
48
+
35
49
runs {
36
50
client {
37
- workingDirectory project. file(' run' )
38
-
39
- // Recommended logging data for a userdev environment
40
- property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
41
-
42
- // Recommended logging level for the console
43
- property ' forge.logging.console.level' , ' debug'
44
-
51
+ workingDirectory(project. file(devRunClientPath))
52
+ property(" forge.logging.markers" , " SCAN,REGISTRIES,REGISTRYDUMP" )
53
+ property(" forge.logging.console.level" , " debug" )
45
54
mods {
46
- examplemod {
47
- source sourceSets. main
55
+ ProjectEssentialsPermissions {
56
+ source( sourceSets. main)
48
57
}
49
58
}
50
59
}
51
60
52
61
server {
53
- workingDirectory project. file(' run' )
54
-
55
- // Recommended logging data for a userdev environment
56
- property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
57
-
58
- // Recommended logging level for the console
59
- property ' forge.logging.console.level' , ' debug'
60
-
62
+ workingDirectory(project. file(devRunServerPath))
63
+ property(" forge.logging.markers" , " SCAN,REGISTRIES,REGISTRYDUMP" )
64
+ property(" forge.logging.console.level" , " debug" )
61
65
mods {
62
- examplemod {
63
- source sourceSets. main
64
- }
65
- }
66
- }
67
-
68
- data {
69
- workingDirectory project. file(' run' )
70
-
71
- // Recommended logging data for a userdev environment
72
- property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
73
-
74
- // Recommended logging level for the console
75
- property ' forge.logging.console.level' , ' debug'
76
-
77
- args ' --mod' , ' examplemod' , ' --all' , ' --output' , file(' src/generated/resources/' )
78
-
79
- mods {
80
- examplemod {
81
- source sourceSets. main
66
+ ProjectEssentialsPermissions {
67
+ source(sourceSets. main)
82
68
}
83
69
}
84
70
}
85
71
}
86
72
}
87
73
74
+ repositories {
75
+ jcenter()
76
+ mavenCentral()
77
+ maven { url(" https://minecraft.curseforge.com/api/maven/" ) }
78
+ maven { url(" https://libraries.minecraft.net" ) }
79
+ }
80
+
88
81
dependencies {
89
- // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
90
- // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
91
- // The userdev artifact is a special name and will get all sorts of transformations applied to it.
92
- minecraft ' net.minecraftforge:forge:1.14.4-28.0.73'
82
+ minecraft(group : " net.minecraftforge" , name : " forge" , version : forgeBaseVersion)
83
+ compile(group : " com.mojang" , name : " brigadier" , version : brigadierBaseVersion)
84
+ compile(
85
+ group : " org.jetbrains.kotlinx" ,
86
+ name : " kotlinx-serialization-runtime" ,
87
+ version : kotlinxSerializationVersion
88
+ )
89
+ compile(
90
+ group : " org.jetbrains.kotlin" ,
91
+ name : " kotlin-stdlib-$kotlinJdkVersionTarget " ,
92
+ version : kotlinVersion
93
+ )
94
+ }
93
95
94
- // You may put jars on which you depend on in ./libs or you may define them like so..
95
- // compile "some.group:artifact:version:classifier"
96
- // compile "some.group:artifact:version"
96
+ task installMods (type : Copy ) {
97
+ dependsOn(" installClientMods" )
98
+ dependsOn(" installServerMods" )
99
+ }
97
100
98
- // Real examples
99
- // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
100
- // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
101
+ task installClientMods (type : Copy , dependsOn : " deinstallClientMods" ) {
102
+ from { configurations. modClientDependencies }
103
+ include(" **/*.jar" )
104
+ into(file(" $devRunClientPath /mods" ))
105
+ }
101
106
102
- // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
103
- // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
107
+ task installServerMods (type : Copy , dependsOn : " deinstallServerMods" ) {
108
+ from { configurations. modServerDependencies }
109
+ include(" **/*.jar" )
110
+ into(file(" $devRunServerPath /mods" ))
111
+ }
104
112
105
- // These dependencies get remapped to your current MCP mappings
106
- // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
113
+ task deinstallClientMods (type : Delete ) {
114
+ delete(fileTree(dir : " $devRunClientPath /mods" , include : " *.jar" ))
115
+ }
116
+
117
+ task deinstallServerMods (type : Delete ) {
118
+ delete(fileTree(dir : " $devRunServerPath /mods" , include : " *.jar" ))
119
+ }
107
120
108
- // For more info...
109
- // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
110
- // http://www.gradle.org/docs/current/userguide/dependency_management.html
121
+ project. afterEvaluate {
122
+ project. tasks[" prepareRuns" ]. dependsOn(project. tasks[" installClientMods" ])
123
+ project. tasks[" prepareRuns" ]. dependsOn(project. tasks[" installServerMods" ])
124
+ }
111
125
126
+ dokka {
127
+ outputFormat = ' html'
128
+ outputDirectory = " $buildDir /documentation"
112
129
}
113
130
114
- // Example for how to get properties into the manifest for reading by the runtime..
131
+ project. tasks[" jar" ]. dependsOn(project. tasks[" dokka" ])
132
+
115
133
jar {
116
134
manifest {
117
135
attributes([
118
- " Specification-Title" : " examplemod " ,
119
- " Specification-Vendor" : " examplemodsareus " ,
120
- " Specification-Version" : " 1 " , // We are version 1 of ourselves
121
- " Implementation-Title" : project . name ,
122
- " Implementation-Version" : " ${ version } " ,
123
- " Implementation-Vendor" : " examplemodsareus " ,
136
+ " Specification-Title" : projectEssentialsName ,
137
+ " Specification-Vendor" : projectEssentialsVendor ,
138
+ " Specification-Version" : projectEssentialsVersion,
139
+ " Implementation-Title" : projectEssentialsName ,
140
+ " Implementation-Version" : projectEssentialsVersion ,
141
+ " Implementation-Vendor" : projectEssentialsVendor ,
124
142
" Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
125
143
])
126
144
}
127
145
}
128
146
129
- // Example configuration to allow publishing using the maven-publish task
130
- // we define a custom artifact that is sourced from the reobfJar output task
131
- // and then declare that to be published
132
- // Note you'll need to add a repository here
133
- def reobfFile = file(" $buildDir /reobfJar/output.jar" )
134
- def reobfArtifact = artifacts. add(' default' , reobfFile) {
135
- type ' jar'
136
- builtBy ' reobfJar'
137
- }
138
- publishing {
139
- publications {
140
- mavenJava(MavenPublication ) {
141
- artifact reobfArtifact
142
- }
143
- }
144
- repositories {
145
- maven {
146
- url " file:///${ project.projectDir} /mcmodsrepo"
147
- }
147
+ sourceCompatibility = targetCompatibility =
148
+ compileJava. sourceCompatibility =
149
+ compileJava. targetCompatibility = jvmVersionTarget
150
+
151
+ compileKotlin. kotlinOptions. jvmTarget =
152
+ compileTestKotlin. kotlinOptions. jvmTarget = jvmVersionTarget
153
+
154
+ tasks. withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile ). all {
155
+ kotlinOptions {
156
+ freeCompilerArgs + = " -Xuse-experimental=kotlin.Experimental"
148
157
}
149
- }
158
+ }
0 commit comments