From 8e2ac0a677fa28f6551a2cb3926ada2075b16a78 Mon Sep 17 00:00:00 2001 From: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:29:07 -0300 Subject: [PATCH] Cringefy the codebase Something something this will let us be more dynamic blah blah blah I just worry about the entire toolchain suddenly freezing in place at the wrong moment --- README.md | 14 +++++++++----- .../main/groovy/mod_conventions_common.gradle | 4 ---- common/build.gradle | 10 +++++----- .../ok_zoomer/wrench_wrapper/WrenchWrapper.java | 14 ++++++++------ fabric/build.gradle | 6 +++--- .../config/modmenu/OkZoomerModMenuEntry.java | 2 -- .../wrench_wrapper/quilt/QuiltWrapper.java | 13 +++++++++++-- gradle/libs.versions.toml | 16 ++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 45 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index df24e4b4..e3f4527d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -Ok Zoomer icon - # Ok Zoomer -Ok Zoomer is a mod that adds a highly configurable zoom key packed with tons of features! +![Banner for the Ok Zoomer mod](https://mod-assets.upcraft.dev/promo/ok-zoomer/modpage_banner.png) + +![A Minecraft landscape with cows and pigs being zoomed using Ok Zoomer's zoom, configured at the default Camera preset.](https://mod-assets.upcraft.dev/promo/ok-zoomer/showcase_camera.avif) + +What you are seeing here is the best zoom mod around here. It is faster than those who claim to be simple, it is lighter than bloated competitors with megabytes of dependencies, it is powerful with its configurability and its many presets, and most importantly, it is never afraid to innovate, having popularized zoom transitions on its release and always introducing new features. + +The zoom key is bound to C by default, with the zoom itself prioritizing a smooth transition between the user's interface and a clean view, which is perfect for screenshots! But if you want something else? We have options! -By default, a unique take on zooming is provided, however, by configuring this mod through Mod Menu or a file, the zoom can be adapted for your own purposes! Here's an example: want a cinematic camera while zooming? Enable it! Want to have a better control over it? Toggle it to the Multiplied mode and adjust the multiplier! Do you hate it but still want some grip on the zoom? Enable "Reduce Sensitivity"! On this mod, you are in charge of the zoom! +By going to Mod Menu or by using the `/ok_zoomer` command, you can choose other presets such as "Competitive" (prioritizes your interface), "Classic" (emulates OptiFine's zoom), Spyglass, and others! You can also tweak other options such as Zoom Transition, Cinematic Camera, Zoom Divisor, and much more! -For more information, see the [Modrinth](https://modrinth.com/mod/ok-zoomer) or [CurseForge](https://www.curseforge.com/minecraft/mc-mods/ok-zoomer) pages. +You can see more information on the options on the [wiki](https://github.com/Up-Mods/OkZoomer/wiki/Configuration). ## Download diff --git a/buildSrc/src/main/groovy/mod_conventions_common.gradle b/buildSrc/src/main/groovy/mod_conventions_common.gradle index 9a762e11..8fbdeccb 100644 --- a/buildSrc/src/main/groovy/mod_conventions_common.gradle +++ b/buildSrc/src/main/groovy/mod_conventions_common.gradle @@ -50,10 +50,6 @@ repositories { includeGroup("maven.modrinth") } } - maven { - name = 'Quilt' - url = 'https://maven.quiltmc.org/repository/release' - } maven { url = 'https://maven.uuid.gg/releases' } // Up's Mods // maven { url = 'https://maven.ladysnake.org/releases' } } diff --git a/common/build.gradle b/common/build.gradle index c0fac91a..a7601c19 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,6 +1,6 @@ plugins { id 'mod_conventions_common' - alias libs.plugins.quilt.loom + alias libs.plugins.fabric.loom } base.archivesName = 'ok_zoomer-common' @@ -9,12 +9,12 @@ base.archivesName = 'ok_zoomer-common' // See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work. dependencies { minecraft libs.minecraft - mappings loom.officialMojangMappings() - /* mappings(loom.layered { + //mappings loom.officialMojangMappings() + mappings(loom.layered { it.officialMojangMappings() it.parchment libs.parchment - }) */ - modImplementation libs.quilt.loader + })/home/ennui/Documents/Quilt/1.21.4/OkZoomer/fabric/build/libs/ok_zoomer-fabric-0.0.0-development.jar + modImplementation libs.fabric.loader modCompileOnly libs.wrench.wrapper } diff --git a/common/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/WrenchWrapper.java b/common/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/WrenchWrapper.java index beb1a3be..448a848a 100644 --- a/common/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/WrenchWrapper.java +++ b/common/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/WrenchWrapper.java @@ -4,19 +4,22 @@ import org.quiltmc.config.api.ReflectiveConfig; import java.lang.reflect.InvocationTargetException; +import java.util.Objects; public class WrenchWrapper { @NotNull public static C create(String family, String id, Class configCreatorClass) { try { if (WrenchWrapper.getClass("org.quiltmc.loader.api.QuiltLoader") != null) { - var clazz = WrenchWrapper.getClass("io.github.ennuil.ok_zoomer.wrench_wrapper.quilt.QuiltWrapper"); + var clazz = Objects.requireNonNull(WrenchWrapper.getClass("io.github.ennuil.ok_zoomer.wrench_wrapper.quilt.QuiltWrapper")); return (C) clazz.getMethod("create", String.class, String.class, Class.class).invoke(null, family, id, configCreatorClass); - } else if (WrenchWrapper.getClass("net.fabricmc.loader.FabricLoader") != null) { - var clazz = WrenchWrapper.getClass("io.github.ennuil.ok_zoomer.wrench_wrapper.fabric.FabricWrapper"); + } else if (WrenchWrapper.getClass("net.fabricmc.loader.FabricLoader") != null + && WrenchWrapper.getClass("net.neoforged.neoforge.common.NeoForge") == null) { + // The above check immunizes Wrench Wrapper's wrapper against Sinytra Connector + var clazz = Objects.requireNonNull(WrenchWrapper.getClass("io.github.ennuil.ok_zoomer.wrench_wrapper.fabric.FabricWrapper")); return (C) clazz.getMethod("create", String.class, String.class, Class.class).invoke(null, family, id, configCreatorClass); } else if (WrenchWrapper.getClass("net.neoforged.neoforge.common.NeoForge") != null) { - var clazz = WrenchWrapper.getClass("io.github.ennuil.ok_zoomer.wrench_wrapper.norge.NorgeWrapper"); + var clazz = Objects.requireNonNull(WrenchWrapper.getClass("io.github.ennuil.ok_zoomer.wrench_wrapper.norge.NorgeWrapper")); return (C) clazz.getMethod("create", String.class, String.class, Class.class).invoke(null, family, id, configCreatorClass); } else { throw new IllegalStateException("Neither Quilt, Fabric nor NeoForge detected, cannot create Config Instance for %s!".formatted(configCreatorClass.getName())); @@ -28,8 +31,7 @@ public static C create(String family, String id, Cl public static Class getClass(String className) { try { - var clazz = Class.forName(className); - return clazz; + return Class.forName(className); } catch (ClassNotFoundException e) { return null; } diff --git a/fabric/build.gradle b/fabric/build.gradle index 60940aeb..7b902a7e 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,6 +1,6 @@ plugins { id 'mod_conventions_loader' - alias libs.plugins.quilt.loom + alias libs.plugins.fabric.loom } repositories { @@ -17,14 +17,14 @@ dependencies { it.officialMojangMappings() it.parchment libs.parchment }) - modImplementation libs.quilt.loader + modImplementation libs.fabric.loader modImplementation libs.fabric.api modCompileOnly libs.modmenu modLocalRuntime libs.modmenu - modCompileOnly libs.wrench.wrapper + modImplementation libs.wrench.wrapper //modCompileOnly libs.bundles.trinkets //modLocalRuntime libs.bundles.trinkets diff --git a/fabric/src/main/java/io/github/ennuil/ok_zoomer/config/modmenu/OkZoomerModMenuEntry.java b/fabric/src/main/java/io/github/ennuil/ok_zoomer/config/modmenu/OkZoomerModMenuEntry.java index 973d784d..11fb3877 100644 --- a/fabric/src/main/java/io/github/ennuil/ok_zoomer/config/modmenu/OkZoomerModMenuEntry.java +++ b/fabric/src/main/java/io/github/ennuil/ok_zoomer/config/modmenu/OkZoomerModMenuEntry.java @@ -3,9 +3,7 @@ import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; import io.github.ennuil.ok_zoomer.config.screen.OkZoomerConfigScreen; -import org.quiltmc.loader.api.minecraft.ClientOnly; -@ClientOnly public class OkZoomerModMenuEntry implements ModMenuApi { @Override public ConfigScreenFactory getModConfigScreenFactory() { diff --git a/fabric/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/quilt/QuiltWrapper.java b/fabric/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/quilt/QuiltWrapper.java index 44ec7c99..804551db 100644 --- a/fabric/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/quilt/QuiltWrapper.java +++ b/fabric/src/main/java/io/github/ennuil/ok_zoomer/wrench_wrapper/quilt/QuiltWrapper.java @@ -1,10 +1,19 @@ package io.github.ennuil.ok_zoomer.wrench_wrapper.quilt; +import io.github.ennuil.ok_zoomer.wrench_wrapper.WrenchWrapper; import org.quiltmc.config.api.ReflectiveConfig; -import org.quiltmc.loader.api.config.v2.QuiltConfig; + +import java.lang.reflect.InvocationTargetException; public class QuiltWrapper { public static C create(String family, String id, Class configCreatorClass) { - return QuiltConfig.create(family, id, configCreatorClass); + var clazz = WrenchWrapper.getClass("org.quiltmc.loader.api.config.v2.QuiltConfig"); + if (clazz == null) return null; + + try { + return (C) clazz.getMethod("create", String.class, String.class, Class.class).invoke(null, family, id, configCreatorClass); + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { + return null; + } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 116d3781..f3ab09a3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,13 +3,13 @@ minecraft = "1.21.3" parchment = "2024.11.17" -quilt_loom = "1.8.5" -quilt_loader = "0.27.1-beta.1" -moddevgradle = "2.0.44-beta" -neoforge = "21.3.36-beta" +fabric_loom = "1.8.13" +fabric_loader = "0.16.9" +moddevgradle = "2.0.48-beta" +neoforge = "21.3.42-beta" -fabric_api = "0.109.0+1.21.3" -wrench_wrapper = "0.6.0" +fabric_api = "0.110.0+1.21.3" +wrench_wrapper = "0.6.1" modmenu = "12.0.0-beta.1" trinkets = "3.10.0" @@ -17,7 +17,7 @@ cca = "6.1.1" [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } -quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loader" } +fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } parchment = { module = "org.parchmentmc.data:parchment-1.21.1", version.ref = "parchment" } fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } @@ -33,5 +33,5 @@ cca_entity = { module = "org.ladysnake.cardinal-components-api:cardinal-componen trinkets = ["trinkets", "cca_base", "cca_entity"] [plugins] -quilt_loom = { id = "org.quiltmc.loom", version.ref = "quilt_loom" } +fabric_loom = { id = "fabric-loom", version.ref = "fabric_loom" } moddevgradle = { id = "net.neoforged.moddev", version.ref = "moddevgradle" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 94113f20..e2847c82 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME