1+ plugins {
2+ id ' fabric-loom' version " 0.7-SNAPSHOT" // To use chocoloom, change the version to a commit hash
3+ id ' maven-publish'
4+ }
5+
6+ sourceCompatibility = JavaVersion . VERSION_1_8
7+ targetCompatibility = JavaVersion . VERSION_1_8
8+
9+ archivesBaseName = project. archives_base_name
10+ version = " ${ project.mod_version} +${ project.minecraft_version} " as Object
11+ group = project. maven_group
12+
13+ repositories {
14+ maven {
15+ name = " legacy-fabric"
16+ url = " https://maven.legacyfabric.net"
17+ }
18+ }
19+
20+ // Comment out this block if you're using Chocoloom
21+ // Comment when using loom 0.10
22+ minecraft {
23+ intermediaryUrl = {
24+ return " https://maven.legacyfabric.net/net/fabricmc/intermediary/" + it + " /intermediary-" + it + " -v2.jar" ;
25+ }
26+ }
27+
28+ dependencies {
29+ minecraft " com.mojang:minecraft:${ project.minecraft_version} "
30+ mappings " net.fabricmc:yarn:${ project.yarn_mappings} :v2"
31+ modImplementation " net.fabricmc:fabric-loader:${ project.loader_version} "
32+
33+ // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default.
34+ // If you know for a fact you don't, it's not required and can be safely removed.
35+ // modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") {
36+ // exclude module: "fabric-loader-1.8.9"
37+ // }
38+
39+ // Hacks that make mac os work
40+ if (System . getProperty(" os.name" ). toLowerCase(). contains(" mac" )) {
41+ implementation ' org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209'
42+ implementation ' org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209'
43+ implementation ' org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209'
44+ }
45+ }
46+
47+ // More hacks that make mac os work
48+ if (System . getProperty(" os.name" ). toLowerCase(). contains(" mac" )) {
49+ configurations. all {
50+ resolutionStrategy {
51+ dependencySubstitution {
52+ substitute module(' org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222' ) with module(' org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' )
53+ substitute module(' org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222' ) with module(' org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' )
54+ }
55+ force ' org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209'
56+ }
57+ }
58+ }
59+
60+ processResources {
61+ inputs. property " version" , project. version
62+
63+ filesMatching(" fabric.mod.json" ) {
64+ expand " version" : project. version
65+ }
66+ }
67+
68+ // ensure that the encoding is set to UTF-8, no matter what the system default is
69+ // this fixes some edge cases with special characters not displaying correctly
70+ // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
71+ tasks. withType(JavaCompile ). configureEach {
72+ it. options. encoding = " UTF-8"
73+ if (JavaVersion . current(). isJava9Compatible()) it. options. release = 8
74+ }
75+
76+ java {
77+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
78+ // if it is present.
79+ // If you remove this line, sources will not be generated.
80+ withSourcesJar()
81+ }
82+
83+ jar {
84+ from(" LICENSE" ) {
85+ rename { " ${ it} _${ project.archivesBaseName} " }
86+ }
87+ }
88+
89+ // configure the maven publication
90+ publishing {
91+ publications {
92+ mavenJava(MavenPublication ) {
93+ from components. java
94+ }
95+ }
96+
97+ // select the repositories you want to publish to
98+ repositories {
99+ // uncomment to publish to the local maven
100+ // mavenLocal()
101+ }
102+ }
0 commit comments