This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathbuild.gradle
152 lines (141 loc) · 6.23 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/**
* This is the best Gradle in anarchy
* @author bush, perry
*/
//file:noinspection GroovyAssignabilityCheck I don't like warnings!!!!
//file:noinspection GroovyUnusedAssignment I don't like warnings!!!!
buildscript {
repositories {
// The mavenCentral() alias means that dependencies are fetched from the central Maven 2 repository (https://repo1.maven.org/maven2).
mavenCentral()
// The url to get the spongepowered dependencies from.
maven { url 'https://repo.spongepowered.org/maven' }
// The url to get the forge dependencies from.
maven { url 'https://files.minecraftforge.net/maven' }
}
dependencies {
// Latest 2 version of ForgeGradle will update to 5.1.26 later. Versions list: https://maven.minecraftforge.net/net/minecraftforge/gradle/ForgeGradle/maven-metadata.xml
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3.4'
// Upgrade to 0.7-SNAPSHOT when upgrading ForgeGradle to 3.0+ & mixin ver at dependencies has to be 0.8+ for upgrading mixingradle ver. https://github.com/SpongePowered/MixinGradle
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
// Gradle plugin for all Minecraft mod development needs.
apply plugin: 'net.minecraftforge.gradle.forge'
// Gradle plugin. Mixin is a trait/mixin & bytecode weaving framework for Java using ASM.
apply plugin: 'org.spongepowered.mixin'
// Only edit below this line, the above code adds & enables the necessary things for Forge to be setup.
// The jar version number that will be output when building.
version = modversion
// https://maven.apache.org/guides/mini/guide-naming-conventions.html
group = modgroup
// The jar name that will be output when building.
archivesBaseName = modid
// Need this here so eclipse task generates correctly.
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
// This ensures that the generated class files will be compatible with JVMs specified by targetCompatibility.
sourceCompatibility = targetCompatibility = '1.8'
// Makes it so u don't need to convert unicode to basic latin for it to be able to build/run.
options.encoding 'UTF-8'
}
minecraft {
// The version of forge & if u want to update to the patch 1.12.2-14.23.5.2860 for log4j exploit u need to have ForgeGradle 3+ version.
version = mcforgeversion
// The directory of where the files that are output when doing runClient will be put.
runDir = 'run'
// MCP Mapping version.
mappings = mappingsversion
// An Srg named sources jar is made by default. No point for it aka bloat so it has been disabled.
makeObfSourceJar = false
// Tells FML to load our mixin loader in IDE's.
clientJvmArgs += '-Dfml.coreMods.load=' + mixinclass
// Tells mixin to use our mixin config in IDE's.
clientRunArgs += '--mixin ' + mixinconfig
}
mixin {
// The obfuscation environment to use when generating refMaps. This is the obfuscation which will end up in the mappings in the generated refMap.
defaultObfuscationEnv searge // Types of obf env: searge, notch.
// Sets the main sourceSets refmap name instead of add sourceSets.main so there is no conflict cause of it adding another value instead of setting the 1 value.
sourceSets {
main {
ext.refMap = 'mixins.cosmos.refmap.json'
}
}
}
repositories {
// The mavenCentral() alias means that dependencies are fetched from the central Maven 2 repository (https://repo1.maven.org/maven2).
mavenCentral()
// The url to get the spongepowered dependencies from.
maven { url 'https://repo.spongepowered.org/maven' }
// The url to get GitHub repositories from
maven { url 'https://jitpack.io' }
}
configurations {
// Adds a reference so that we extend/add on to it with depends so we can grab them and compile them into the jar.
embed
// Grabs what's extended/added on from/to embed and compiles it into the jar when being built.
compile.extendsFrom embed
}
dependencies {
implementation 'org.jetbrains:annotations:19.0.0'
// Upgrading to 0.8+ can possibly break compatibility with other clients like Future/RusherHack.
embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Excludes unneeded stuff.
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
// Compiles the library needed for Discord RPC's and grabs the actual disc dlls from the disc repo and puts it in so can't say the disc dlls are rats lel.
embed('club.minnced:java-discord-rpc:2.0.2') {
// For no reason it includes the com.sun.jna library.
exclude module: 'jna'
}
// File reader.
embed ('com.moandjiezana.toml:toml4j:0.7.2') {
// Why include google gson.
exclude module: 'gson'
}
// Microsoft Authentication
embed 'com.github.litarvan:OpenAuth:1.1.2'
}
processResources {
// This will ensure that this task is redone when the versions change.
inputs.property 'version', project.version
// Replace stuff in mcmod.info, Nothing else.
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// Replace version.
expand 'version': project.version
}
// Copy everything else except the mcmod.info.
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
jar {
from(configurations.embed.collect {
it.isDirectory() ? it : zipTree(it)
}) {
// Excludes/Removes useless bloat files from the compiled jar.
exclude 'dummyThing',
'LICENSE.txt',
'META-INF/MUMFREY.RSA',
'META-INF/maven/**',
'org/**/*.html'
}
manifest.attributes(
// Name for the clients mixins.json.
'MixinConfigs': mixinconfig,
// Directory for the org library mixin loader.
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
// Actually not too sure what this is for.
'TweakOrder': 0,
// Directory for the mixin loader for the built jar.
'FMLCorePlugin': mixinclass,
// Turn this to false for the client to be able to load in a IDE.
'ForceLoadAsMod': 'true'
)
}