plugins { id 'net.fabricmc.fabric-loom-remap' version '1.17.21' } version = project.mod_version group = project.maven_group base { archivesName = project.archives_base_name } loom { accessWidenerPath = file('src/main/resources/prestige-client.accesswidener') runs { client { client() ideConfigGenerated(true) runDir 'run' programArg '--offlineDeveloperMode' // dev command file / screenshot facility of the overlay: ./gradlew runClient -PuiCmd= if (project.hasProperty('uiCmd')) vmArg "-Dprestige.ui.cmd=${project.property('uiCmd')}" // dev: -PdumpClasses=ap,C,c9 forces class init of instrumented classes (tools/java/ClinitDump.java, bridge/DumpHook) if (project.hasProperty('dumpClasses')) vmArg "-Dprestige.dump=${project.property('dumpClasses')}" // engine test driver (engine/EngineDev): ./gradlew runClient -PengineCmd= [-PengineReport=] [-PquickPlay=] if (project.hasProperty('engineCmd')) vmArg "-Dprestige.engine.cmd=${project.property('engineCmd')}" if (project.hasProperty('engineReport')) vmArg "-Dprestige.engine.report=${project.property('engineReport')}" if (project.hasProperty('quickPlay')) { programArg '--quickPlaySingleplayer'; programArg project.property('quickPlay') } } } mods { "prestige" { sourceSet sourceSets.main } } } configurations { // Libraries copied (unpacked) into the final mod jar so it is self-contained. shade implementation.extendsFrom shade engineMappings } repositories { mavenCentral() } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" // Dear ImGui. The binding contains the Java classes, lwjgl3 the GL3/GLFW backend and // natives-* the imgui-java64 libraries (extracted from the jar at runtime by imgui-java). // Linux natives are x86_64 only; the macOS dylib is universal (x86_64 + arm64). shade "io.github.spair:imgui-java-binding:${project.imgui_version}" // imgui-java-lwjgl3 pulls LWJGL 3.4.1 transitively, which replaces Minecraft's 3.3.3 jars and breaks world saving shade("io.github.spair:imgui-java-lwjgl3:${project.imgui_version}") { exclude group: 'org.lwjgl' } shade "io.github.spair:imgui-java-natives-windows:${project.imgui_version}" shade "io.github.spair:imgui-java-natives-linux:${project.imgui_version}" shade "io.github.spair:imgui-java-natives-macos:${project.imgui_version}" // ClassTransform (net.lenni0451, customised build); engine/EnginePlugin uses it to apply the client's @CTransformer hooks. shade files('libs/classtransform-bundled.jar') // Yarn tiny shipped as prestige-engine/mappings.tiny for the production (Intermediary) runtime engineMappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" } processResources { inputs.property "version", project.version filteringCharset "UTF-8" filesMatching("fabric.mod.json") { expand "version": project.version } } tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" options.release = 21 } java { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 withSourcesJar() } jar { // Unpack the shaded libs (imgui classes + native dll, ClassTransform) into the mod jar. from({ configurations.shade.collect { it.isDirectory() ? it : zipTree(it) } }) { exclude 'META-INF/MANIFEST.MF', 'META-INF/*.SF', 'META-INF/*.RSA', 'META-INF/*.DSA' exclude 'module-info.class', 'META-INF/versions/**' } from({ zipTree(configurations.engineMappings.singleFile) }) { include 'mappings/mappings.tiny' eachFile { it.relativePath = new RelativePath(true, 'prestige-engine', 'mappings.tiny') } includeEmptyDirs = false } duplicatesStrategy = DuplicatesStrategy.EXCLUDE }