From 968dad40682968c862216d7dbf511155ce8e729a Mon Sep 17 00:00:00 2001 From: Nolij Date: Fri, 5 Jan 2024 15:40:41 -0500 Subject: [PATCH] unimined go brr* (*vintage forge and primitive to not go brr in dev) --- .github/workflows/build.yml | 2 - archaic/build.gradle | 49 ----- archaic/build.gradle.kts | 49 +++++ .../dev/nolij/zume/archaic/ArchaicZume.java | 7 +- build.gradle | 162 --------------- build.gradle.kts | 191 ++++++++++++++++++ common/build.gradle | 23 --- common/build.gradle.kts | 31 +++ gradle.properties | 30 ++- legacy/build.gradle | 51 ----- legacy/build.gradle.kts | 40 ++++ .../zume/legacy/mixin/GameRendererMixin.java | 8 +- legacy/src/main/resources/fabric.mod.json | 4 +- modern/build.gradle | 35 ---- modern/build.gradle.kts | 41 ++++ modern/src/main/resources/fabric.mod.json | 4 +- primitive/build.gradle | 74 ------- primitive/build.gradle.kts | 54 +++++ .../nolij/zume/primitive/PrimitiveZume.java | 9 +- .../dev/nolij/zume/primitive/ZumeKeyBind.java | 4 +- .../primitive/event/KeyBindingRegistrar.java | 2 +- .../primitive/mixin/GameRendererAccessor.java | 14 +- .../primitive/mixin/GameRendererMixin.java | 8 +- .../primitive/mixin/MinecraftAccessor.java | 2 +- .../zume/primitive/mixin/MinecraftMixin.java | 2 +- primitive/src/main/resources/fabric.mod.json | 4 +- settings.gradle | 21 +- src/main/resources/fabric.mod.json | 8 +- src/main/resources/mcmod.info | 2 +- vintage/build.gradle | 61 ------ vintage/build.gradle.kts | 56 +++++ .../dev/nolij/zume/vintage/VintageZume.java | 7 +- 32 files changed, 544 insertions(+), 511 deletions(-) delete mode 100644 archaic/build.gradle create mode 100644 archaic/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 common/build.gradle create mode 100644 common/build.gradle.kts delete mode 100644 legacy/build.gradle create mode 100644 legacy/build.gradle.kts delete mode 100644 modern/build.gradle create mode 100644 modern/build.gradle.kts delete mode 100644 primitive/build.gradle create mode 100644 primitive/build.gradle.kts delete mode 100644 vintage/build.gradle create mode 100644 vintage/build.gradle.kts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d79ba86..f7f3a47e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,6 @@ jobs: java-version: '17' - name: Adjust Gradle permission run: chmod +x ./gradlew - - name: :setupCIWorkspace - run: ./gradlew setupCIWorkspace - name: :build run: ./gradlew build - name: Upload artifacts diff --git a/archaic/build.gradle b/archaic/build.gradle deleted file mode 100644 index 95aeda93..00000000 --- a/archaic/build.gradle +++ /dev/null @@ -1,49 +0,0 @@ -plugins { - id "java-library" - id "com.gtnewhorizons.retrofuturagradle" -} - -// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) - // Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64 - vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL) - } -} - -minecraft { - mcVersion.set(archaic_minecraft_version) - username.set("Developer") - - injectedTags.put("MOD_VERSION", mod_version) - injectedTags.put("MOD_NAME", "Zume") - injectedTags.put("VERSION_RANGE", archaic_minecraft_range) -} - -tasks.injectTags.outputClassName.set("${maven_group}.zume.archaic.Tags") - -def mixinProviderSpec = "com.github.LegacyModdingMC.UniMixins:unimixins-all-1.7.10:${unimixins_version}:dev" - -dependencies { - implementation(annotationProcessor(modUtils.enableMixins(mixinProviderSpec, "zume-archaic-refmap.json"))) - - implementation "blue.endless:jankson:${jankson_version}" - - implementation(project(":common")) -} - -jar { - manifest { - attributes ( - "FMLCorePluginContainsFMLMod": true, - "ForceLoadAsMod": true, - "MixinConfigs": "zume-archaic.mixins.json", - "TweakClass": "org.spongepowered.asm.launch.MixinTweaker" - ) - } -} - -processResources { - from "common/src/main/resources" -} diff --git a/archaic/build.gradle.kts b/archaic/build.gradle.kts new file mode 100644 index 00000000..e18ef85d --- /dev/null +++ b/archaic/build.gradle.kts @@ -0,0 +1,49 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask + +operator fun String.invoke(): String { + return (rootProject.properties[this] as String?)!! +} + +unimined.minecraft { + version("archaic_minecraft_version"()) + + runs { + config("server") { + disabled = true + } + } + + minecraftForge { + loader("archaic_forge_version"()) + mixinConfig("zume-${project.name}.mixins.json") + } + + mappings { + searge() + mcp("stable", "archaic_mappings_version"()) + } + + defaultRemapJar = true +} + +tasks.withType { + mixinRemap { + enableMixinExtra() + } +} + +dependencies { + "modImplementation"("com.github.LegacyModdingMC.UniMixins:unimixins-all-1.7.10:${"unimixins_version"()}:dev") + + implementation(project(":common")) +} + +tasks.processResources { + from("common/src/main/resources") + + filteringCharset = "UTF-8" + +// filesMatching("mcmod.info") { +// expand(rootProject.properties) +// } +} \ No newline at end of file diff --git a/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZume.java b/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZume.java index 368ff868..85133ad4 100644 --- a/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZume.java +++ b/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZume.java @@ -3,6 +3,7 @@ import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import dev.nolij.zume.archaic.mixin.EntityRendererAccessor; +import dev.nolij.zume.common.Constants; import dev.nolij.zume.common.IZumeProvider; import dev.nolij.zume.common.Zume; import cpw.mods.fml.client.registry.ClientRegistry; @@ -18,9 +19,9 @@ @Mod( modid = Zume.MOD_ID, - name = Tags.MOD_NAME, - version = Tags.MOD_VERSION, - acceptedMinecraftVersions = Tags.VERSION_RANGE, + name = Constants.MOD_NAME, + version = Constants.MOD_VERSION, + acceptedMinecraftVersions = Constants.ARCHAIC_VERSION_RANGE, guiFactory = "dev.nolij.zume.archaic.ArchaicConfigProvider", dependencies = "required-after:unimixins@[0.1.15,)") public class ArchaicZume implements IZumeProvider { diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 3152badd..00000000 --- a/build.gradle +++ /dev/null @@ -1,162 +0,0 @@ -plugins { - id "com.github.johnrengelman.shadow" version "8.1.1" - id "maven-publish" - id "com.modrinth.minotaur" version "2.+" - id "io.github.themrmilchmann.curseforge-publish" version "0.4.0" - id "babric-loom" version "1.4-SNAPSHOT" apply false - id "com.gtnewhorizons.retrofuturagradle" version "1.3.25" apply false -} - -group = maven_group - -allprojects { - apply plugin: "java" - - version = mod_version - - java { - withSourcesJar() - } - - repositories { - mavenCentral() - maven { - name = "Fabric" - url = "https://maven.fabricmc.net/" - } - maven { - name = "Babric" - url = "https://maven.glass-launcher.net/babric" - } - maven { url "https://jitpack.io/" } - } - - dependencies { - annotationProcessor "com.github.bsideup.jabel:jabel-javac-plugin:${jabel_version}" - compileOnly "com.github.bsideup.jabel:jabel-javac-plugin:${jabel_version}" - } - - tasks.withType(JavaCompile).configureEach { - if (it.name in ["compileMcLauncherJava", "compilePatchedMcJava"]) { - return - } - - it.options.encoding = "UTF-8" - - it.sourceCompatibility = 17 // for the IDE support - it.options.release = 8 - - it.javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(17) - } - } -} - -subprojects { - archivesBaseName = rootProject.archives_base_name + "-" + project.name - group = rootProject.maven_group + "." + archivesBaseName -} - -configurations { - shade - compileClasspath.extendsFrom shade - runtimeClasspath.extendsFrom shade - developmentFabric.extendsFrom shade -} - -def fabricImpls = [project(":modern"), project(":primitive"), project(":legacy")] -def legacyForgeImplNames = ["archaic", "vintage"] -def legacyForgeImpls = legacyForgeImplNames.collect { project(":${it}") } -def impls = [project(":common"), *fabricImpls, *legacyForgeImpls] - -dependencies { - compileOnly "net.fabricmc:fabric-loader:${loader_version}" - - shade(implementation("blue.endless:jankson:${jankson_version}")) - - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core - compileOnly "org.apache.logging.log4j:log4j-core:2.22.0" - - impls.forEach { - shade(it) { transitive false } - } -} - -java { - archivesBaseName = archives_base_name -} - -shadowJar { - from("LICENSE") { - rename { "${it}_${archives_base_name}"} - } - - configurations = [project.configurations.shade] - archiveClassifier = "" - - legacyForgeImpls.forEach { - it.afterEvaluate { - def reobfJar = it.reobfJar - dependsOn reobfJar - from(zipTree(reobfJar.archivePath)) - } - } - - def legacyForgeMixinConfigs = [] - legacyForgeImplNames.forEach { - def implName = it - legacyForgeMixinConfigs.push("zume-${implName}.mixins.json") - } - - relocate "blue.endless.jankson", "dev.nolij.zume.shadow.blue.endless.jankson" - - manifest { - attributes ( - "FMLCorePluginContainsFMLMod": true, - "ForceLoadAsMod": true, - "MixinConfigs": legacyForgeMixinConfigs.join(","), - "TweakClass": "org.spongepowered.asm.launch.MixinTweaker" - ) - } -} - -sourcesJar { - impls.forEach { - def sourcesJarTask = it.sourcesJar - dependsOn sourcesJarTask - from(sourcesJarTask.archiveFile.map { zipTree(it) }) { exclude "fabric.mod.json", "mcmod.info" } - } -} - -build.dependsOn(shadowJar) - -processResources { - from "common/src/main/resources" - - inputs.property "version", version - inputs.property "loader_version", loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": version, - "loader_version": loader_version - } - - filesMatching("mcmod.info") { - expand "mod_version": version, - "minecraft_version": archaic_minecraft_version - } -} - -// configure the maven publication -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..129c1d11 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,191 @@ +import okhttp3.internal.immutableListOf +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask + +plugins { + id("java") + id("com.github.johnrengelman.shadow") version "8.1.1" + id("maven-publish") + id("com.modrinth.minotaur") version "2.+" + id("io.github.themrmilchmann.curseforge-publish") version "0.4.0" + id("com.github.gmazzo.buildconfig") version "5.2.0" apply(false) + id("xyz.wagyourtail.unimined") version "1.2.0-SNAPSHOT" +} + +operator fun String.invoke(): String { + return (rootProject.properties[this] as String?)!! +} + +group = "maven_group"() +version = "mod_version"() + +base { + archivesName = "archives_base_name"() +} + +allprojects { + apply(plugin = "java") + apply(plugin = "maven-publish") + + repositories { + mavenCentral() + maven("https://repo.spongepowered.org/maven") + maven("https://jitpack.io/") + exclusiveContent { + forRepository { + maven("https://api.modrinth.com/maven") + } + filter { + includeGroup("maven.modrinth") + } + } + } + + tasks.withType { + if (name !in arrayOf("compileMcLauncherJava", "compilePatchedMcJava")) { + options.encoding = "UTF-8" + sourceCompatibility = "17" + options.release = 8 + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(17) + } + } + } + + dependencies { + val jabelDependency = "com.github.bsideup.jabel:jabel-javac-plugin:${"jabel_version"()}" + annotationProcessor(jabelDependency) + compileOnly(jabelDependency) + } +} + +subprojects { + val subProject = this + + apply(plugin = "xyz.wagyourtail.unimined") + + group = "maven_group"() + version = "mod_version"() + + base { + archivesName = "${"archives_base_name"()}-${subProject.name}" + } + + tasks.withType { + enabled = false + } + + dependencies { + implementation("blue.endless:jankson:${"jankson_version"()}") + } +} + +unimined.minecraft { + version("modern_minecraft_version"()) + + runs { + config("client") { + disabled = true + } + config("server") { + disabled = true + } + } + + fabric { + loader("fabric_version"()) + } + + mappings { + intermediary() + yarn("modern_mappings_version"()) + devFallbackNamespace("intermediary") + } + + defaultRemapJar = false +} + +val fabricImpls = arrayOf( + "modern", + "legacy", + "primitive", +) +val legacyForgeImpls = arrayOf( + "archaic", + "vintage", +) +val uniminedImpls = arrayOf( + *fabricImpls, + *legacyForgeImpls, +) +val impls = arrayOf( + "common", + *uniminedImpls, +) + +configurations { + val shade = create("shade") + + compileClasspath.get().extendsFrom(shade) + runtimeClasspath.get().extendsFrom(shade) +} + +dependencies { + "shade"("blue.endless:jankson:${"jankson_version"()}") + + // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core + compileOnly("org.apache.logging.log4j:log4j-core:2.22.0") + + "shade"(project(":common")) { isTransitive = false } + + uniminedImpls.forEach { + implementation(project(":${it}")) { isTransitive = false } + } +} + +tasks.processResources { + from("common/src/main/resources") + + filteringCharset = "UTF-8" + + filesMatching(immutableListOf("fabric.mod.json", "mcmod.info")) { + expand(rootProject.properties) + } +} + +tasks.jar { + enabled = false +} + +tasks.shadowJar { + val shadowJar = this + from("LICENSE") { + rename { "${it}_${"archives_base_name"()}" } + } + + configurations = immutableListOf(project.configurations["shade"]) + archiveClassifier = "" + isPreserveFileTimestamps = false + + uniminedImpls.forEach { + val remapJar = project(":${it}").tasks.withType()["remapJar"] + shadowJar.dependsOn(remapJar) + from(zipTree(remapJar.archiveFile.get())) { + exclude("fabric.mod.json", "mcmod.info") + } + } + + relocate("blue.endless.jankson", "dev.nolij.zume.shadow.blue.endless.jankson") + + manifest { + attributes( + "FMLCorePluginContainsFMLMod" to true, + "ForceLoadAsMod" to true, + "MixinConfigs" to legacyForgeImpls.joinToString(",") { "zume-${it}.mixins.json" }, + "TweakClass" to "org.spongepowered.asm.launch.MixinTweaker" + ) + } +} + +tasks.build { + dependsOn(tasks.shadowJar) +} \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle deleted file mode 100644 index b991d565..00000000 --- a/common/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -repositories { - maven { - name = "Sponge" - url = "https://repo.spongepowered.org/repository/maven-public/" - } -} - -dependencies { - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core - compileOnly "org.apache.logging.log4j:log4j-core:2.22.0" - - compileOnly "org.ow2.asm:asm-tree:9.6" - compileOnly "org.spongepowered:mixin:0.8.5" - - compileOnly "blue.endless:jankson:${jankson_version}" - - testImplementation platform("org.junit:junit-bom:5.9.1") - testImplementation "org.junit.jupiter:junit-jupiter" -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 00000000..a10856bf --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,31 @@ +plugins { + id("com.github.gmazzo.buildconfig") +} + +operator fun String.invoke(): String { + return (rootProject.properties[this] as String?)!! +} + +buildConfig { + className("Constants") + packageName("dev.nolij.zume.common") + + useJavaOutput() + + buildConfigField("MOD_VERSION", "mod_version"()) + buildConfigField("MOD_NAME", "Zume") + buildConfigField("ARCHAIC_VERSION_RANGE", "archaic_minecraft_range"()) + buildConfigField("VINTAGE_VERSION_RANGE", "vintage_minecraft_range"()) +} + +repositories { + maven("https://repo.spongepowered.org/repository/maven-public/") +} + +dependencies { + // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core + compileOnly("org.apache.logging.log4j:log4j-core:2.22.0") + + compileOnly("org.ow2.asm:asm-tree:9.6") + compileOnly("org.spongepowered:mixin:0.8.5") +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index f21fc6dd..39cbffab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,46 +7,54 @@ archives_base_name = zume # Fabric # https://modmuss50.me/fabric.html -loader_version=0.15.3 +fabric_version=0.15.3 ## Modern Fabric # https://modmuss50.me/fabric.html modern_minecraft_version=1.20.1 -modern_mappings_version=1.20.1+build.10 -modern_loader_version=0.15.3 +modern_mappings_version=10 +modern_fabric_version=0.15.3 modern_fabric_api_version=0.91.0+1.20.1 ## Legacy Fabric # https://grayray75.github.io/LegacyFabric-Versions/ legacy_minecraft_version=1.7.10 -legacy_mappings_version=1.7.10+build.533 -legacy_loader_version=0.15.3 +legacy_mappings_version=533 +legacy_fabric_version=0.15.3 legacy_fabric_api_version=1.9.1+1.7.10 ## Primitive Fabric # https://babric.github.io/develop/ primitive_minecraft_version=b1.7.3 -primitive_mappings_version=b1.7.3-build.2 -primitive_loader_version=0.15.3 +primitive_mappings_version=a00e3b0 +primitive_fabric_version=0.14.24-babric.1 # https://maven.glass-launcher.net/#/releases/net/modificationstation/StationAPI # https://maven.glass-launcher.net/#/snapshots/net/modificationstation/StationAPI -station_api_version=2.0-alpha.1 +station_api_version=261e793 # Legacy Forge -# https://github.com/LegacyModdingMC/UniMixins/releases/latest -unimixins_version=0.1.15 ## Archaic Forge archaic_minecraft_version=1.7.10 archaic_minecraft_range=[1.7.10] +archaic_mappings_version=12-1.7.10 +archaic_forge_version=10.13.4.1614-1.7.10 +# https://github.com/LegacyModdingMC/UniMixins/releases/latest +unimixins_version=0.1.15 ## Vintage Forge vintage_minecraft_version=1.12.2 vintage_minecraft_range=[1.8.9,1.12.2] +vintage_mappings_version=39-1.12 +vintage_forge_version=14.23.5.2860 +# https://github.com/CleanroomMC/MixinBooter/releases/latest +mixinbooter_version=8.8 # Misc Dependencies # https://central.sonatype.com/artifact/com.github.bsideup.jabel/jabel-javac-plugin jabel_version=1.0.0 # https://central.sonatype.com/artifact/blue.endless/jankson/overview -jankson_version=1.2.3 \ No newline at end of file +jankson_version=1.2.3 +# https://github.com/LlamaLad7/MixinExtras/releases/latest +mixinextras_version=0.2.1 \ No newline at end of file diff --git a/legacy/build.gradle b/legacy/build.gradle deleted file mode 100644 index 452cbf3e..00000000 --- a/legacy/build.gradle +++ /dev/null @@ -1,51 +0,0 @@ -plugins { - id "babric-loom" -} - -loom { - intermediaryUrl.set("https://maven.legacyfabric.net/net/legacyfabric/intermediary/%1\$s/intermediary-%1\$s-v2.jar") - runs { - client { - programArgs "--userProperties", "{}" - } - } -} - -repositories { - maven { - name = "legacy-fabric" - url = "https://repo.legacyfabric.net/repository/legacyfabric/" - } -} - -dependencies { - minecraft "com.mojang:minecraft:${legacy_minecraft_version}" - mappings "net.legacyfabric:yarn:${legacy_mappings_version}:v2" - modImplementation "net.fabricmc:fabric-loader:${legacy_loader_version}" - - modImplementation "net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${legacy_fabric_api_version}" - - implementation "blue.endless:jankson:${jankson_version}" - - implementation(project(":common")) -} - -processResources { - from "common/src/main/resources" - - inputs.property "version", mod_version - inputs.property "loader_version", legacy_loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": mod_version, - "loader_version": legacy_loader_version - } -} - -// bypass gradle being dumb -task wrapper(type: Wrapper) { - gradleVersion = "8.4" -} -task prepareKotlinBuildScriptModel { -} \ No newline at end of file diff --git a/legacy/build.gradle.kts b/legacy/build.gradle.kts new file mode 100644 index 00000000..18b08ce4 --- /dev/null +++ b/legacy/build.gradle.kts @@ -0,0 +1,40 @@ +operator fun String.invoke(): String { + return (rootProject.properties[this] as String?)!! +} + +unimined.minecraft { + version("legacy_minecraft_version"()) + + runs { + config("server") { + disabled = true + } + } + + fabric { + loader("fabric_version"()) + } + + mappings { + legacyIntermediary() + legacyYarn("legacy_mappings_version"()) + } + + defaultRemapJar = true +} + +dependencies { + "modImplementation"(fabricApi.legacyFabricModule("legacy-fabric-keybindings-api-v1-common", "legacy_fabric_api_version"())) + + implementation(project(":common")) +} + +tasks.processResources { + from("common/src/main/resources") + + filteringCharset = "UTF-8" + + filesMatching("fabric.mod.json") { + expand(rootProject.properties) + } +} \ No newline at end of file diff --git a/legacy/src/main/java/dev/nolij/zume/legacy/mixin/GameRendererMixin.java b/legacy/src/main/java/dev/nolij/zume/legacy/mixin/GameRendererMixin.java index b5100e59..c037e46d 100644 --- a/legacy/src/main/java/dev/nolij/zume/legacy/mixin/GameRendererMixin.java +++ b/legacy/src/main/java/dev/nolij/zume/legacy/mixin/GameRendererMixin.java @@ -33,18 +33,18 @@ public class GameRendererMixin { @Dynamic @ModifyExpressionValue(method = { "method_1331", "tick", // archaic - "method_9775(FJ)V", "method_1321()V" // vintage + "method_9775(FJ)V" // vintage }, at = @At(value = "FIELD", target = "Lnet/minecraft/client/option/GameOptions;smoothCameraEnabled:Z")) - public boolean zume$archaic$smoothCameraEnabled(boolean original) { + public boolean zume$smoothCameraEnabled(boolean original) { return Zume.transformCinematicCamera(original); } @Dynamic @ModifyExpressionValue(method = { "method_1331", "tick", // archaic - "method_9775(FJ)V", "method_1321()V" // vintage + "method_9775(FJ)V" // vintage }, at = @At(value = "FIELD", target = "Lnet/minecraft/client/option/GameOptions;sensitivity:F")) - public float zume$archaic$mouseSensitivity(float original) { + public float zume$mouseSensitivity(float original) { return (float) Zume.transformMouseSensitivity(original); } diff --git a/legacy/src/main/resources/fabric.mod.json b/legacy/src/main/resources/fabric.mod.json index 8bd8eee0..bf5af229 100644 --- a/legacy/src/main/resources/fabric.mod.json +++ b/legacy/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "zume", - "version": "${version}", + "version": "${mod_version}", "name": "Zume", "description": "A simple zoom mod by Nolij", "authors": [ @@ -23,7 +23,7 @@ "zume-legacy.mixins.json" ], "depends": { - "fabricloader": ">=${loader_version}", + "fabricloader": ">=${legacy_fabric_version}", "legacy-fabric-keybinding-api-v1-common": "*" } } diff --git a/modern/build.gradle b/modern/build.gradle deleted file mode 100644 index edb2a80e..00000000 --- a/modern/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -plugins { - id "babric-loom" -} - -dependencies { - minecraft "com.mojang:minecraft:${modern_minecraft_version}" - mappings "net.fabricmc:yarn:${modern_mappings_version}:v2" - modImplementation "net.fabricmc:fabric-loader:${modern_loader_version}" - - modImplementation "net.fabricmc.fabric-api:fabric-api:${modern_fabric_api_version}" - - implementation "blue.endless:jankson:${jankson_version}" - - implementation(project(":common")) -} - -processResources { - from "common/src/main/resources" - - inputs.property "version", mod_version - inputs.property "loader_version", modern_loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": mod_version, - "loader_version": modern_loader_version - } -} - -// bypass gradle being dumb -task wrapper(type: Wrapper) { - gradleVersion = "8.4" -} -task prepareKotlinBuildScriptModel { -} \ No newline at end of file diff --git a/modern/build.gradle.kts b/modern/build.gradle.kts new file mode 100644 index 00000000..e5da9e4b --- /dev/null +++ b/modern/build.gradle.kts @@ -0,0 +1,41 @@ +operator fun String.invoke(): String { + return (rootProject.properties[this] as String?)!! +} + +unimined.minecraft { + version("modern_minecraft_version"()) + + runs { + config("server") { + disabled = true + } + } + + fabric { + loader("fabric_version"()) + } + + mappings { + intermediary() + yarn("modern_mappings_version"()) + devFallbackNamespace("intermediary") + } + + defaultRemapJar = true +} + +dependencies { + "modImplementation"(fabricApi.fabricModule("fabric-key-binding-api-v1", "modern_fabric_api_version"())) + + implementation(project(":common")) +} + +tasks.processResources { + from("common/src/main/resources") + + filteringCharset = "UTF-8" + + filesMatching("fabric.mod.json") { + expand(rootProject.properties) + } +} \ No newline at end of file diff --git a/modern/src/main/resources/fabric.mod.json b/modern/src/main/resources/fabric.mod.json index e718f186..c66b74cb 100644 --- a/modern/src/main/resources/fabric.mod.json +++ b/modern/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "zume", - "version": "${version}", + "version": "${mod_version}", "name": "Zume", "description": "A simple zoom mod by Nolij", "authors": [ @@ -23,7 +23,7 @@ "zume-modern.mixins.json" ], "depends": { - "fabricloader": ">=${loader_version}", + "fabricloader": ">=${modern_fabric_version}", "fabric-key-binding-api-v1": "*" } } diff --git a/primitive/build.gradle b/primitive/build.gradle deleted file mode 100644 index 7318ee62..00000000 --- a/primitive/build.gradle +++ /dev/null @@ -1,74 +0,0 @@ -plugins { - id "babric-loom" -} - -loom { - gluedMinecraftJar() - customMinecraftManifest.set("https://babric.github.io/manifest-polyfill/${primitive_minecraft_version}.json") - intermediaryUrl.set("https://maven.glass-launcher.net/babric/babric/intermediary/%1\$s/intermediary-%1\$s-v2.jar") -} - -repositories { - maven { - name = "Babric" - url = "https://maven.glass-launcher.net/babric" - } - maven { - name = "Glass Releases" - url = "https://maven.glass-launcher.net/releases" - } - maven { - name = "Glass Snapshots" - url = "https://maven.glass-launcher.net/snapshots" - } - maven { - name = "Forge" - url = "https://maven.minecraftforge.net/" - } - exclusiveContent { - forRepository { - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - } - } - filter { - includeGroup "maven.modrinth" - } - } -} - -dependencies { - minecraft "com.mojang:minecraft:${primitive_minecraft_version}" - mappings "net.glasslauncher:bin:${primitive_mappings_version}" - modImplementation "net.fabricmc:fabric-loader:${primitive_loader_version}" - - modImplementation "net.modificationstation:StationAPI:${station_api_version}" - - implementation "blue.endless:jankson:${jankson_version}" - - implementation "org.slf4j:slf4j-api:1.8.0-beta4" - implementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" - - implementation(project(":common")) -} - -processResources { - from "common/src/main/resources" - - inputs.property "version", mod_version - inputs.property "loader_version", primitive_loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": mod_version, - "loader_version": primitive_loader_version - } -} - -// bypass gradle being dumb -task wrapper(type: Wrapper) { - gradleVersion = "8.4" -} -task prepareKotlinBuildScriptModel { -} \ No newline at end of file diff --git a/primitive/build.gradle.kts b/primitive/build.gradle.kts new file mode 100644 index 00000000..6fd80733 --- /dev/null +++ b/primitive/build.gradle.kts @@ -0,0 +1,54 @@ +operator fun String.invoke(): String { + return (rootProject.properties[this] as String?)!! +} + +unimined.minecraft { + side("client") + + version("primitive_minecraft_version"()) + + runs { + config("client") { + javaVersion = JavaVersion.VERSION_17 + } + } + + babric { + loader("primitive_fabric_version"()) + } + + mappings { + babricIntermediary() + biny("primitive_mappings_version"()) + devFallbackNamespace("intermediary") + } + + defaultRemapJar = true +} + +repositories { + maven("https://maven.glass-launcher.net/snapshots") +} + +dependencies { + "modImplementation"(fabricApi.stationModule(moduleName = "station-keybindings-v0", version = "station_api_version"())) + + val mixinExtras = "io.github.llamalad7:mixinextras-fabric:${"mixinextras_version"()}" +// annotationProcessor(mixinExtras) + implementation(mixinExtras) + + implementation("org.slf4j:slf4j-api:1.8.0-beta4") + implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0") + + implementation(project(":common")) +} + +tasks.processResources { + from("common/src/main/resources") + + filteringCharset = "UTF-8" + + filesMatching("fabric.mod.json") { + expand(rootProject.properties) + } +} \ No newline at end of file diff --git a/primitive/src/main/java/dev/nolij/zume/primitive/PrimitiveZume.java b/primitive/src/main/java/dev/nolij/zume/primitive/PrimitiveZume.java index 23da590f..d0ba546e 100644 --- a/primitive/src/main/java/dev/nolij/zume/primitive/PrimitiveZume.java +++ b/primitive/src/main/java/dev/nolij/zume/primitive/PrimitiveZume.java @@ -6,7 +6,7 @@ import dev.nolij.zume.primitive.mixin.MinecraftAccessor; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.util.Smoother; +import net.minecraft.client.util.SmoothUtil; public class PrimitiveZume implements ClientModInitializer, IZumeProvider { @@ -37,10 +37,11 @@ public boolean isZoomOutPressed() { @Override public void onZoomActivate() { + //noinspection ConstantValue if (Zume.CONFIG.enableCinematicZoom && !MinecraftAccessor.getInstance().options.cinematicMode) { - final GameRendererAccessor gameRenderer = (GameRendererAccessor) MinecraftAccessor.getInstance().gameRenderer; - gameRenderer.setCinematicYawSmoother(new Smoother()); - gameRenderer.setCinematicPitchSmoother(new Smoother()); + final GameRendererAccessor gameRenderer = (GameRendererAccessor) MinecraftAccessor.getInstance().field_2818; + gameRenderer.setCinematicYawSmoother(new SmoothUtil()); + gameRenderer.setCinematicPitchSmoother(new SmoothUtil()); } } diff --git a/primitive/src/main/java/dev/nolij/zume/primitive/ZumeKeyBind.java b/primitive/src/main/java/dev/nolij/zume/primitive/ZumeKeyBind.java index a396019d..0280425b 100644 --- a/primitive/src/main/java/dev/nolij/zume/primitive/ZumeKeyBind.java +++ b/primitive/src/main/java/dev/nolij/zume/primitive/ZumeKeyBind.java @@ -1,6 +1,6 @@ package dev.nolij.zume.primitive; -import net.minecraft.client.options.KeyBinding; +import net.minecraft.client.option.KeyBinding; import org.lwjgl.input.Keyboard; public enum ZumeKeyBind { @@ -14,7 +14,7 @@ public enum ZumeKeyBind { public final KeyBinding value; public boolean isPressed() { - return Keyboard.isKeyDown(value.key); + return Keyboard.isKeyDown(value.code); } ZumeKeyBind(String translationKey, int code) { diff --git a/primitive/src/main/java/dev/nolij/zume/primitive/event/KeyBindingRegistrar.java b/primitive/src/main/java/dev/nolij/zume/primitive/event/KeyBindingRegistrar.java index 963ef3f6..3f63fa6a 100644 --- a/primitive/src/main/java/dev/nolij/zume/primitive/event/KeyBindingRegistrar.java +++ b/primitive/src/main/java/dev/nolij/zume/primitive/event/KeyBindingRegistrar.java @@ -2,7 +2,7 @@ import dev.nolij.zume.primitive.ZumeKeyBind; import net.mine_diver.unsafeevents.listener.EventListener; -import net.minecraft.client.options.KeyBinding; +import net.minecraft.client.option.KeyBinding; import net.modificationstation.stationapi.api.client.event.option.KeyBindingRegisterEvent; import java.util.List; diff --git a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererAccessor.java b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererAccessor.java index 8e137918..64ba8ad6 100644 --- a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererAccessor.java +++ b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererAccessor.java @@ -1,16 +1,16 @@ package dev.nolij.zume.primitive.mixin; -import net.minecraft.client.util.Smoother; -import net.minecraft.sortme.GameRenderer; +import net.minecraft.class_555; +import net.minecraft.client.util.SmoothUtil; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(GameRenderer.class) +@Mixin(class_555.class) public interface GameRendererAccessor { - @Accessor("cinematicYawSmoother") - void setCinematicYawSmoother(Smoother value); - @Accessor("cinematicPitchSmoother") - void setCinematicPitchSmoother(Smoother value); + @Accessor("field_2353") + void setCinematicYawSmoother(SmoothUtil value); + @Accessor("field_2354") + void setCinematicPitchSmoother(SmoothUtil value); } diff --git a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererMixin.java b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererMixin.java index 8db75036..7af3199e 100644 --- a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererMixin.java +++ b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/GameRendererMixin.java @@ -2,14 +2,14 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import dev.nolij.zume.common.Zume; -import net.minecraft.sortme.GameRenderer; +import net.minecraft.class_555; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(GameRenderer.class) +@Mixin(class_555.class) public class GameRendererMixin { @Inject(method = "method_1844", at = @At("HEAD")) @@ -24,12 +24,12 @@ public class GameRendererMixin { } } - @ModifyExpressionValue(method = "method_1844", at = @At(value = "FIELD", target = "Lnet/minecraft/client/options/GameOptions;cinematicMode:Z")) + @ModifyExpressionValue(method = "method_1844", at = @At(value = "FIELD", target = "Lnet/minecraft/client/option/GameOptions;cinematicMode:Z")) public boolean zume$updateMouse$smoothCameraEnabled(boolean original) { return Zume.transformCinematicCamera(original); } - @ModifyExpressionValue(method = "method_1844", at = @At(value = "FIELD", target = "Lnet/minecraft/client/options/GameOptions;mouseSensitivity:F")) + @ModifyExpressionValue(method = "method_1844", at = @At(value = "FIELD", target = "Lnet/minecraft/client/option/GameOptions;mouseSensitivity:F")) public float zume$updateMouse$mouseSensitivity(float original) { return (float) Zume.transformMouseSensitivity(original); } diff --git a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftAccessor.java b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftAccessor.java index 8aa10897..aec4b00c 100644 --- a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftAccessor.java +++ b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftAccessor.java @@ -7,7 +7,7 @@ @Mixin(Minecraft.class) public interface MinecraftAccessor { - @Accessor("instance") + @Accessor("INSTANCE") static Minecraft getInstance() { throw new AssertionError(); } diff --git a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftMixin.java b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftMixin.java index a84e8409..919ba020 100644 --- a/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftMixin.java +++ b/primitive/src/main/java/dev/nolij/zume/primitive/mixin/MinecraftMixin.java @@ -10,7 +10,7 @@ @Mixin(Minecraft.class) public class MinecraftMixin { - @WrapWithCondition(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;scrollInHotbar(I)V")) + @WrapWithCondition(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;method_692(I)V")) public boolean onMouseScroll$scrollInHotbar(PlayerInventory instance, int scrollAmount) { return Zume.transformHotbarScroll(scrollAmount); } diff --git a/primitive/src/main/resources/fabric.mod.json b/primitive/src/main/resources/fabric.mod.json index b325056e..0cdf490a 100644 --- a/primitive/src/main/resources/fabric.mod.json +++ b/primitive/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "zume", - "version": "${version}", + "version": "${mod_version}", "name": "Zume", "description": "A simple zoom mod by Nolij", "authors": [ @@ -26,7 +26,7 @@ "zume-primitive.mixins.json" ], "depends": { - "fabricloader": ">=${loader_version}", + "fabricloader": ">=${primitive_fabric_version}", "station-keybindings-v0": "*" } } diff --git a/settings.gradle b/settings.gradle index 916b20cb..f8809300 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ pluginManagement { repositories { + mavenCentral() maven { name = "Fabric" url = "https://maven.fabricmc.net/" @@ -21,16 +22,32 @@ pluginManagement { includeGroup("com.gtnewhorizons.retrofuturagradle") } } - gradlePluginPortal() + maven { + name = "Unimined Releases" + url = "https://maven.wagyourtail.xyz/releases" + } + maven { + name = "Unimined Snapshots" + url = "https://maven.wagyourtail.xyz/snapshots" + } + gradlePluginPortal() { + content { + excludeGroup("org.apache.logging.log4j") + } + } } + plugins { + id 'org.jetbrains.kotlin.jvm' version '1.9.22' + } } plugins { id "org.gradle.toolchains.foojay-resolver-convention" version "0.7.0" } + include "common" include "modern" -include "primitive" include "legacy" +include "primitive" include "archaic" include "vintage" \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 64006fc0..d8fd9e26 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "zume", - "version": "${version}", + "version": "${mod_version}", "name": "Zume", "description": "A simple zoom mod by Nolij", "authors": [ @@ -24,10 +24,10 @@ }, "mixins": [ "zume-modern.mixins.json", - "zume-primitive.mixins.json", - "zume-legacy.mixins.json" + "zume-legacy.mixins.json", + "zume-primitive.mixins.json" ], "depends": { - "fabricloader": [">=${loader_version}", "0.14.24-babric.1"] + "fabricloader": [">=${modern_fabric_version}", "${primitive_fabric_version}"] } } diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 38df9155..032f8d7f 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -4,7 +4,7 @@ "name": "Zume", "description": "A simple zoom mod by Nolij", "version": "${mod_version}", - "mcversion": "${minecraft_version}", + "mcversion": "${archaic_minecraft_version}", "url": "https://github.com/Nolij/Zume", "updateUrl": "", "authorList": ["Nolij"], diff --git a/vintage/build.gradle b/vintage/build.gradle deleted file mode 100644 index cdfe061c..00000000 --- a/vintage/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -plugins { - id "java-library" - id "com.gtnewhorizons.retrofuturagradle" -} - -// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) - // Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64 - vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL) - } -} - -minecraft { - mcVersion.set(vintage_minecraft_version) - username.set("Developer") - - injectedTags.put("MOD_VERSION", mod_version) - injectedTags.put("MOD_NAME", "Zume") - injectedTags.put("VERSION_RANGE", vintage_minecraft_range) -} - -tasks.injectTags.outputClassName.set("${maven_group}.zume.vintage.Tags") - -repositories { - maven { url "https://maven.cleanroommc.com" } -} - -dependencies { - annotationProcessor "org.ow2.asm:asm-debug-all:5.2" - annotationProcessor "com.google.guava:guava:32.1.2-jre" - annotationProcessor "com.google.code.gson:gson:2.8.9" - - def mixinBooter = modUtils.enableMixins("zone.rong:mixinbooter:8.9", "zume-vintage-refmap.json") - api (mixinBooter) { - transitive = false - } - annotationProcessor (mixinBooter) { - transitive = false - } - - implementation "blue.endless:jankson:${jankson_version}" - - implementation(project(":common")) -} - -jar { - manifest { - attributes ( - "FMLCorePluginContainsFMLMod": true, - "ForceLoadAsMod": true, - "MixinConfigs": "zume-vintage.mixins.json", - "TweakClass": "org.spongepowered.asm.launch.MixinTweaker" - ) - } -} - -processResources { - from "common/src/main/resources" -} diff --git a/vintage/build.gradle.kts b/vintage/build.gradle.kts new file mode 100644 index 00000000..e36438c9 --- /dev/null +++ b/vintage/build.gradle.kts @@ -0,0 +1,56 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask + +operator fun String.invoke(): String { + return (rootProject.properties[this] as String?)!! +} + +unimined.minecraft { + version("vintage_minecraft_version"()) + + runs { + config("client") { + args.addAll(arrayOf("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")) + } + config("server") { + disabled = true + } + } + + minecraftForge { + loader("vintage_forge_version"()) + mixinConfig("zume-${project.name}.mixins.json") + } + + mappings { + searge() + mcp("stable", "vintage_mappings_version"()) + } + + defaultRemapJar = true +} + +tasks.withType { + mixinRemap { + enableMixinExtra() + } +} + +repositories { + maven("https://maven.cleanroommc.com/") +} + +dependencies { + "modImplementation"("zone.rong:mixinbooter:${"mixinbooter_version"()}") + + implementation(project(":common")) +} + +tasks.processResources { + from("common/src/main/resources") + + filteringCharset = "UTF-8" + +// filesMatching("mcmod.info") { +// expand(rootProject.properties) +// } +} \ No newline at end of file diff --git a/vintage/src/main/java/dev/nolij/zume/vintage/VintageZume.java b/vintage/src/main/java/dev/nolij/zume/vintage/VintageZume.java index 181df3fc..c521d66e 100644 --- a/vintage/src/main/java/dev/nolij/zume/vintage/VintageZume.java +++ b/vintage/src/main/java/dev/nolij/zume/vintage/VintageZume.java @@ -1,5 +1,6 @@ package dev.nolij.zume.vintage; +import dev.nolij.zume.common.Constants; import dev.nolij.zume.vintage.mixin.EntityRendererAccessor; import dev.nolij.zume.common.IZumeProvider; import dev.nolij.zume.common.Zume; @@ -18,9 +19,9 @@ @Mod( modid = Zume.MOD_ID, - name = Tags.MOD_NAME, - version = Tags.MOD_VERSION, - acceptedMinecraftVersions = Tags.VERSION_RANGE, + name = Constants.MOD_NAME, + version = Constants.MOD_VERSION, + acceptedMinecraftVersions = Constants.VINTAGE_VERSION_RANGE, guiFactory = "dev.nolij.zume.vintage.VintageConfigProvider", dependencies = "required-after:mixinbooter@*") public class VintageZume implements IZumeProvider {