-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
127 lines (111 loc) · 2.78 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
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
repositories {
maven {
name 'amadornes Maven, for MCMultipart'
url "http://maven.amadornes.com/"
}
maven {
url "http://dvs1.progwml6.com/files/maven"
}
}
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
version = config.mod_version
group = config.mod_group
archivesBaseName = "${config.mod_name}-${config.mc_version}"
if(System.env.BUILD_NUMBER)
version = "${config.mod_version}.b${System.env.BUILD_NUMBER}"
minecraft {
version = "${config.mc_version}-${config.forge_version}"
runDir = "run"
replace "@VERSION@", project.version
mappings = "${config.forge_mappings}"
}
dependencies {
compile "mezz.jei:jei_${config.jei_mc_version}:${config.jei_version}"
}
jar {
// Exclude Gimp files
exclude '**/*.xcf'
// Exclude Audacity Files
exclude '**/*_data/*'
exclude '**/*.aup'
// Exclude Blender Files
exclude '**/*.blend'
exclude '**/*.blend?'
// Exclude .svg files
exclude '**/*.svg'
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "config.mc_version", project.minecraft.version
// Replace properties in info files
from(sourceSets.main.resources.srcDirs) {
include '*.info'
expand 'version':config.version,'mcversion':project.minecraft.version
}
// Filter out unsupported keys from the material files to keep console output clean
from(sourceSets.main.resources.srcDirs) {
include '**/*.mtl'
filter {String line ->
isValidMtlLine(line) ? line : null
}
}
}
// Cleans up all material files in-place.
// Manually run to have a clean repository.
task cleanupMtl {
doLast {
FileTree tree = fileTree('resources/assets/taam/models') {
include '**/*.mtl'
}
tree.each {File file ->
println "Attempting to fix $file.name"
List<String> content = new ArrayList<String>(20)
BufferedReader reader = new BufferedReader(new FileReader(file))
String currentLine
while((currentLine = reader.readLine()) != null) {
if(isValidMtlLine(currentLine)) {
content.add(currentLine)
}
}
reader.close()
BufferedWriter writer = new BufferedWriter(new FileWriter(file))
content.each {String line ->
writer.write(line)
writer.write('\n')
}
writer.close()
}
}
}
boolean isValidMtlLine(String line) {
if(
line.startsWith('illum') ||
line.startsWith('Ns') ||
line.startsWith('Ni') ||
line.startsWith('Ks') ||
line.startsWith('Ke')
) {
return false
}
return true
}