Skip to content

Commit

Permalink
Cringefy the codebase
Browse files Browse the repository at this point in the history
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
  • Loading branch information
EnnuiL committed Nov 26, 2024
1 parent 12a7e68 commit 8e2ac0a
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 36 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<img src="common/src/main/resources/assets/ok_zoomer/icon.png" align="right" width="128px" alt="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 <kbd>C</kbd> 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

Expand Down
4 changes: 0 additions & 4 deletions buildSrc/src/main/groovy/mod_conventions_common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
}
Expand Down
10 changes: 5 additions & 5 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'mod_conventions_common'
alias libs.plugins.quilt.loom
alias libs.plugins.fabric.loom
}

base.archivesName = 'ok_zoomer-common'
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 extends ReflectiveConfig> C create(String family, String id, Class<C> 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()));
Expand All @@ -28,8 +31,7 @@ public static <C extends ReflectiveConfig> 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;
}
Expand Down
6 changes: 3 additions & 3 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'mod_conventions_loader'
alias libs.plugins.quilt.loom
alias libs.plugins.fabric.loom
}

repositories {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 extends ReflectiveConfig> C create(String family, String id, Class<C> 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;
}
}
}
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
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"
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" }
Expand All @@ -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" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8e2ac0a

Please sign in to comment.