-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
138 lines (119 loc) · 4.55 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
buildscript {
repositories {
maven { url "https://maven.minecraftforge.net" }
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT"
}
}
plugins {
id "java"
id "com.github.johnrengelman.shadow" version "2.0.4"
}
apply plugin: "net.minecraftforge.gradle.forge"
//TODO: Change the version, group, and archivesBaseName to your own.
version = "1.0" // The version number of your mod.
group = "me.mqlvin.wwp" // This is the group of the mod (usually domain or your name -> at.manuthebyte)
archivesBaseName = "woolwars" // This is the name of the jar that is generated.
sourceCompatibility = targetCompatibility = 1.8 // Java version to compile for.
compileJava.options.encoding = "UTF-8" // Make sure that the encoding is set to UTF-8, so we have no encoding issues.
minecraft {
version = "1.8.9-11.15.1.2318-1.8.9" // Version 1.8.9
runDir = "run" // Where to put the forge run data (mods, configs, etc.), in a normal minecraft installation this is .minecraft
mappings = "stable_22" // The mappings for 1.8.9
makeObfSourceJar = false // Disables the creation of a source jar
}
// This is the configuration for the shadow plugin, which is used to add libraries to the jar.
configurations {
shade
compile.extendsFrom(shade)
}
def systemOs = System.getProperty("os.name").toLowerCase(Locale.ENGLISH)
/**
* This is where we bundle mixins into the jar.
* shade -> bundles the library into the jar
* compile -> library only available at compile time (not accessible at runtime)
*/
dependencies {
if (systemOs.contains("mac"))
{
compile 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209'
compile 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209'
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209'
}
else if (systemOs.contains("linux"))
{
compile 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-babric.1'
compile 'org.lwjgl.lwjgl:lwjgl:2.9.4-babric.1'
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-babric.1'
}
}
if (systemOs.contains("mac"))
{
configurations.all
{
resolutionStrategy
{
dependencySubstitution
{
substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209')
substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209')
}
force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209'
}
}
} else if (systemOs.contains("linux"))
{
configurations.all
{
resolutionStrategy
{
dependencySubstitution
{
substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') using module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-babric.1')
substitute module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') using module('org.lwjgl.lwjgl:lwjgl:2.9.4-babric.1')
}
force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-babric.1'
}
}
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// Replaces version in mcmod.info with the project version.
from(sourceSets.main.resources.srcDirs) {
include "mcmod.info"
//replace version and mcversion
expand "version":project.version, "mcversion":project.minecraft.version
}
// Copies all other resources.
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
// This is the configuration for the shadow plugin, which is used to add libraries to the jar.
shadowJar {
dependencies {}
configurations = [project.configurations.shade] // Adds the gradle configuration "shade" so we can use it.
duplicatesStrategy DuplicatesStrategy.EXCLUDE // Prevents duplicates
classifier ""
}
reobf {
// Reobfuscates the jar.
shadowJar {}
}
// Task that will build the mod and copy it to your instance (need to change the path to your instance)
//TODO: (Optional) Change the path to your instance
task buildAndCopyToMods(type: Copy, dependsOn: 'build') {
from "build/libs"
into "<yourRealInstance>/.minecraft/mods"
include "*.jar"
}
// Task that will build the mod and put it in the "run" folder, and then run the client.
task buildCopyToRunModsAndRun(type: Copy, dependsOn: 'build') {
from "build/libs"
into "run/mods"
include "*.jar"
}
buildCopyToRunModsAndRun.finalizedBy runClient