1
+ buildscript {
2
+ repositories {
3
+ maven { url = ' https://files.minecraftforge.net/maven' }
4
+ jcenter()
5
+ mavenCentral()
6
+ }
7
+ dependencies {
8
+ classpath group : ' net.minecraftforge.gradle' , name : ' ForgeGradle' , version : ' 3.+' , changing : true
9
+ }
10
+ }
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
+
16
+ version = ' 1.0'
17
+ group = ' com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
18
+ archivesBaseName = ' modid'
19
+
20
+ sourceCompatibility = targetCompatibility = compileJava. sourceCompatibility = compileJava. targetCompatibility = ' 1.8' // Need this here so eclipse task generates correctly.
21
+
22
+ println (' Java: ' + System . getProperty(' java.version' ) + ' JVM: ' + System . getProperty(' java.vm.version' ) + ' (' + System . getProperty(' java.vendor' ) + ' ) Arch: ' + System . getProperty(' os.arch' ))
23
+ minecraft {
24
+ // The mappings can be changed at any time, and must be in the following format.
25
+ // snapshot_YYYYMMDD Snapshot are built nightly.
26
+ // stable_# Stables are built at the discretion of the MCP team.
27
+ // Use non-default mappings at your own risk. they may not always work.
28
+ // Simply re-run your setup task after changing the mappings to update your workspace.
29
+ mappings channel : ' snapshot' , version : ' 20201028-1.16.3'
30
+ // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
31
+
32
+ // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
33
+
34
+ // Default run configurations.
35
+ // These can be tweaked, removed, or duplicated as needed.
36
+ runs {
37
+ client {
38
+ workingDirectory project. file(' run' )
39
+
40
+ // Recommended logging data for a userdev environment
41
+ property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
42
+
43
+ // Recommended logging level for the console
44
+ property ' forge.logging.console.level' , ' debug'
45
+
46
+ mods {
47
+ examplemod {
48
+ source sourceSets. main
49
+ }
50
+ }
51
+ }
52
+
53
+ server {
54
+ workingDirectory project. file(' run' )
55
+
56
+ // Recommended logging data for a userdev environment
57
+ property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
58
+
59
+ // Recommended logging level for the console
60
+ property ' forge.logging.console.level' , ' debug'
61
+
62
+ mods {
63
+ examplemod {
64
+ source sourceSets. main
65
+ }
66
+ }
67
+ }
68
+
69
+ data {
70
+ workingDirectory project. file(' run' )
71
+
72
+ // Recommended logging data for a userdev environment
73
+ property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
74
+
75
+ // Recommended logging level for the console
76
+ property ' forge.logging.console.level' , ' debug'
77
+
78
+ // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
79
+ args ' --mod' , ' examplemod' , ' --all' , ' --output' , file(' src/generated/resources/' ), ' --existing' , file(' src/main/resources/' )
80
+
81
+ mods {
82
+ examplemod {
83
+ source sourceSets. main
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ // Include resources generated by data generators.
91
+ sourceSets. main. resources { srcDir ' src/generated/resources' }
92
+
93
+ dependencies {
94
+ // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
95
+ // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
96
+ // The userdev artifact is a special name and will get all sorts of transformations applied to it.
97
+ minecraft ' net.minecraftforge:forge:1.16.4-35.1.0'
98
+
99
+ // You may put jars on which you depend on in ./libs or you may define them like so..
100
+ // compile "some.group:artifact:version:classifier"
101
+ // compile "some.group:artifact:version"
102
+
103
+ // Real examples
104
+ // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
105
+ // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
106
+
107
+ // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
108
+ // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
109
+
110
+ // These dependencies get remapped to your current MCP mappings
111
+ // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
112
+
113
+ // For more info...
114
+ // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
115
+ // http://www.gradle.org/docs/current/userguide/dependency_management.html
116
+
117
+ }
118
+
119
+ // Example for how to get properties into the manifest for reading by the runtime..
120
+ jar {
121
+ manifest {
122
+ attributes([
123
+ " Specification-Title" : " examplemod" ,
124
+ " Specification-Vendor" : " examplemodsareus" ,
125
+ " Specification-Version" : " 1" , // We are version 1 of ourselves
126
+ " Implementation-Title" : project. name,
127
+ " Implementation-Version" : " ${ version} " ,
128
+ " Implementation-Vendor" :" examplemodsareus" ,
129
+ " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
130
+ ])
131
+ }
132
+ }
133
+
134
+ // Example configuration to allow publishing using the maven-publish task
135
+ // This is the preferred method to reobfuscate your jar file
136
+ jar. finalizedBy(' reobfJar' )
137
+ // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
138
+ // publish.dependsOn('reobfJar')
139
+
140
+ publishing {
141
+ publications {
142
+ mavenJava(MavenPublication ) {
143
+ artifact jar
144
+ }
145
+ }
146
+ repositories {
147
+ maven {
148
+ url " file:///${ project.projectDir} /mcmodsrepo"
149
+ }
150
+ }
151
+ }
0 commit comments