|
| 1 | +plugins { |
| 2 | + id("java") |
| 3 | + id("xyz.wagyourtail.unimined") version "1.4.1" |
| 4 | +} |
| 5 | + |
| 6 | + |
| 7 | +val groupName: String by project |
| 8 | +val version: String by project |
| 9 | +val modName: String by project |
| 10 | +val modId = modName.lowercase() |
| 11 | + |
| 12 | +project.version = version |
| 13 | +project.group = "$groupName.$modId" |
| 14 | +base.archivesName = modName |
| 15 | +val loadingPlugin = "$group.${modName}LoadingPlugin" |
| 16 | + |
| 17 | +tasks.withType<JavaCompile>().configureEach { |
| 18 | + options.release = 8 |
| 19 | +} |
| 20 | + |
| 21 | +val jarLibs: Configuration by configurations.creating { |
| 22 | + configurations.implementation.get().extendsFrom(this) |
| 23 | +} |
| 24 | +repositories { |
| 25 | + unimined.wagYourMaven("releases") |
| 26 | + unimined.spongeMaven() |
| 27 | + unimined.curseMaven() |
| 28 | + flatDir { dir(file("libs")); content { includeGroup("extra-mods") } } |
| 29 | + mavenCentral() |
| 30 | +} |
| 31 | + |
| 32 | +unimined.minecraft { |
| 33 | + version("1.12.2") |
| 34 | + mappings { |
| 35 | + searge() |
| 36 | + mcp("stable", "39-1.12") |
| 37 | + } |
| 38 | + |
| 39 | + minecraftForge { |
| 40 | + loader("14.23.5.2860") |
| 41 | + mixinConfig( |
| 42 | + "mixins.$modId.json", |
| 43 | + "mixins.$modId.chunk_display.json", |
| 44 | + "mixins.$modId.clientcommands.json", |
| 45 | + "mixins.$modId.nothirium.json", |
| 46 | + "mixins.$modId.optifine.json" |
| 47 | + ) |
| 48 | + accessTransformer(file("src/main/resources/at.conf")) |
| 49 | + } |
| 50 | + |
| 51 | + runs.config("client") { |
| 52 | + systemProperty("fml.coreMods.load", loadingPlugin) |
| 53 | + systemProperty("mixin.debug.export", "true") |
| 54 | + systemProperty("mixin.debug.verbose", "true") |
| 55 | + } |
| 56 | + |
| 57 | + runs.config("server") { |
| 58 | + enabled = false |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +dependencies { |
| 63 | + implementation("org.spongepowered:mixin:0.8.7") |
| 64 | + "modImplementation"("curse.maven:renderlib-624967:4168831") |
| 65 | + |
| 66 | + // runtime remapping at home - stolen from embeddedt |
| 67 | + for (extraModJar in fileTree(mapOf("dir" to "libs", "include" to "*.jar"))) { |
| 68 | + val basename = extraModJar.name.substring(0, extraModJar.name.length - ".jar".length) |
| 69 | + val versionSep = basename.lastIndexOf("-") |
| 70 | + assert(versionSep != -1) |
| 71 | + val artifactId = basename.take(versionSep) |
| 72 | + val version = basename.substring(versionSep + 1) |
| 73 | + "modImplementation"("extra-mods:$artifactId:$version") |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +tasks { |
| 78 | + jar { |
| 79 | + manifest.attributes( |
| 80 | + mapOf( |
| 81 | + "TweakClass" to "org.spongepowered.asm.launch.MixinTweaker", |
| 82 | + "FMLCorePluginContainsFMLMod" to true, |
| 83 | + "FMLCorePlugin" to loadingPlugin, |
| 84 | + "ForceLoadAsMod" to true, |
| 85 | + ) |
| 86 | + ) |
| 87 | + |
| 88 | + from(jarLibs.map { if (it.isDirectory()) it else zipTree(it) }) { |
| 89 | + exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA") |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + processResources { |
| 94 | + duplicatesStrategy = DuplicatesStrategy.INCLUDE |
| 95 | + inputs.property("version", project.version) |
| 96 | + |
| 97 | + filesMatching("mcmod.info") { |
| 98 | + expand("version" to project.version) |
| 99 | + } |
| 100 | + } |
| 101 | + |
| 102 | + withType<JavaExec>().configureEach { |
| 103 | + environment("LD_LIBRARY_PATH", "${System.getenv("LD_LIBRARY_PATH").orEmpty()}:/run/current-system/sw/lib") |
| 104 | + environment("__GL_THREADED_OPTIMIZATIONS", "0") |
| 105 | + } |
| 106 | +} |
0 commit comments