1+ apply from : ' gradle/property_helper.gradle'
2+
3+ repositories {
4+
5+ // This maven repository hosts files for hundreds of mods. Some notable
6+ // mods include Bookshelf, Botania, BotanyPots, CraftTweaker, DarkUtils,
7+ // GameStages, Patchouli, Psi, and Quark.
8+ maven {
9+
10+ url ' https://maven.blamejared.com'
11+ }
12+
13+ // This maven repository hosts files for dozens of mods. Some notable
14+ // mods include JEI, TinkersConstruct, and ChiselAndBits.
15+ maven {
16+
17+ url ' https://dvs1.progwml6.com/files/maven'
18+ }
19+
20+ // This maven repository hosts files for mods by TheIllusiveC4. This
21+ // includes Curios, Caelus, and other APIs.
22+ maven {
23+
24+ url = ' https://maven.theillusivec4.top/'
25+ }
26+
27+ // This maven repository proxies requests to the CurseForge API. This will
28+ // allow mods without traditional mavens to be used in a dev environment.
29+ // They use the pattern curse.maven:<descriptor>-<projectid>:<fileid> for
30+ // maven coordinates.
31+ maven {
32+
33+ url = ' https://www.cursemaven.com'
34+
35+ // Improve performance by only querying for their specific group.
36+ content {
37+
38+ includeGroup ' curse.maven'
39+ }
40+ }
41+ }
42+
43+ dependencies {
44+
45+ // This section includes mods that are commonly compiled against. It is
46+ // recommended to add support for these mods if it makes sense for the
47+ // content of your mod.
48+ if (getDefaultBoolean(' dependencies_compile_enabled' )) {
49+
50+ }
51+
52+ // This section includes mods that are commonly used by players and meet a
53+ // minimum level of quality and performance. These mods are only available
54+ // at runtime by default meaning you may not directly access their code.
55+ if (getDefaultBoolean(' dependencies_runtime_enabled' )) {
56+
57+ // Replaces the config GUI with a shiny new one. Mods can enable a
58+ // custom menu icon by defining additional properties in the mods.toml
59+ // file of their mod.
60+ deobfRuntime(' catalogue' , ' curse.maven' , ' catalogue-459701' , ' 3399552' )
61+
62+ // Controlling overhauls the keybind menu by adding a search bar and
63+ // other QoL features.
64+ deobfRuntime(' controlling' , ' com.blamejared.controlling' , ' Controlling' , ' 8.0.0' )
65+ }
66+ }
67+
68+ /**
69+ * Creates a deobfuscated compile dependency. These are available at compile
70+ * time and runtime. This means you can reference code from this dependency
71+ * in your mod.
72+ *
73+ * See deobfDep for more info.
74+ */
75+ def deobfCompile (modid , defaultGroup , defaultName , defaultVersion ) {
76+
77+ deobfDep(modid, ' implementation' , defaultGroup, defaultName, defaultVersion)
78+ }
79+
80+ /**
81+ * Creates a deobfuscated runtime dependency. These are only available during
82+ * runtime and not compile time. This means the dependency will show up when
83+ * you run the game but you can not directly reference it's code in your mod.
84+ *
85+ * See deobfDep for more info.
86+ */
87+ def deobfRuntime (modid , defaultGroup , defaultName , defaultVersion ) {
88+
89+ deobfDep(modid, ' runtimeOnly' , defaultGroup, defaultName, defaultVersion)
90+ }
91+
92+ /**
93+ * Creates a new deobfuscated project dependency that is configured using
94+ * properties. This allows for greater flexability and additional logging.
95+ *
96+ * | Property | Description | Example |
97+ * |---------------|---------------------------------------------------|-----------------------|
98+ * | modid_enabled | When set to false the dependency will be skipped. | true/false, y/n, 1/0 |
99+ * | modid_deptype | The type of dependency to create. | compile, runtimeOnly |
100+ * | modid_group | The maven group for the dependency. | net.darkhax.bookshelf |
101+ * | modid_name | The name of the dependency. | Bookshelf-1.16.5 |
102+ * | modid_version | The artefact version of the dependency. | 10.0.7 |
103+ *
104+ * @param modid An ID used in logging and the names of properties.
105+ * @param defaultType The default type of dependency to create.
106+ * @param defaultGroup The default group for the maven coordinate. modid_group
107+ * @param defaultName The default name for the maven coordinate. modid_name
108+ * @param defaultVersion the default version for the maven coordinate. modid_version
109+ */
110+ def deobfDep (modid , defaultType , defaultGroup , defaultName , defaultVersion ) {
111+
112+ if (getDefaultBoolean(" ${ modid} _enabled" )) {
113+
114+ def depType = getDefaultString(" ${ modid} _deptype" , defaultType)
115+ def group = getDefaultString(" ${ modid} _group" , defaultGroup)
116+ def name = getDefaultString(" ${ modid} _name" , defaultName)
117+ def version = getDefaultString(" ${ modid} _version" , defaultVersion)
118+
119+ project. logger. lifecycle(" Dependency ${ modid} added. ${ depType} \' ${ group} :${ name} :${ version} \' " )
120+ project. getDependencies(). add(depType, fg. deobf(" ${ group} :${ name} :${ version} " ))
121+ }
122+
123+ else {
124+
125+ project. logger. warn(" Dependency ${ modid} has been disabled for this build." )
126+ }
127+ }
128+
129+ // Gradle introduced a new metadata format that will override data from other
130+ // formats like Maven. When publishing Forge mods this metadata will include
131+ // dependency entries for mapped versions of Forge and other mods used in the
132+ // userdev environment. Gradle will try and fail to resolve these dependencies.
133+ // The simplest fix is for those publishing artefacts to disable the publishing
134+ // of this metadata or to strip the mapped dependencies however we can not rely
135+ // on them to do that. This code will tell Gradle to ignore that metadata.
136+ project. repositories. each {
137+
138+ if (it. hasProperty(' metadataSources' )) {
139+
140+ it. metadataSources. ignoreGradleMetadataRedirection()
141+ }
142+ }
143+
144+ ext {
145+
146+ deobfDep = this . &deobDep
147+ deobfRuntime = this . &deobRuntime
148+ deobfCompile = this . &deobCompile
149+ }
0 commit comments