Skip to content

Commit

Permalink
Begin cleaning up Ok Zoomer 5.0.0
Browse files Browse the repository at this point in the history
A 6.0.0 may still be needed though :P
  • Loading branch information
EnnuiL committed Aug 20, 2023
1 parent 577fdf2 commit 5842f95
Show file tree
Hide file tree
Showing 32 changed files with 143 additions and 393 deletions.
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ plugins {
alias libs.plugins.machete
}

archivesBaseName = project.archives_base_name
base {
archivesName = project.archives_base_name
}

version = System.env.GITHUB_ACTIONS == 'true'
? "$project.version+${libs.versions.minecraft.get()}.github.$System.env.GITHUB_RUN_NUMBER"
: "$project.version+${libs.versions.minecraft.get()}"
Expand Down Expand Up @@ -44,8 +47,7 @@ dependencies {
processResources {
inputs.property 'version', version

// Oh, for building, do the switcharoo
filesMatching(['quilt.mod.json', 'fabric.mod.json']) {
filesMatching('quilt.mod.json') {
expand 'version': version
}
}
Expand All @@ -72,7 +74,7 @@ java {

jar {
from('LICENSE') {
rename { "${it}_${archivesBaseName}" }
rename { "${it}_${base.archivesName.get()}" }
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# Mod Properties
version = 5.0.0-beta.12
version = 5.0.0-beta.13
maven_group = io.github.ennuil
archives_base_name = ok_zoomer
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
minecraft = "1.20.1"
quilt_mappings = "1.20.1+build.23" # Latest version is available at https://lambdaurora.dev/tools/import_quilt.html
quilt_loader = "0.19.5"
quilt_loader = "0.20.0-beta.15"

quilted_fabric_api = "7.1.2+0.87.0-1.20.1"
libzoomer = "0.7.0+1.20"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 6 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down
5 changes: 0 additions & 5 deletions jitpack.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.ennuil.ok_zoomer;

import org.quiltmc.config.api.annotations.ConfigFieldAnnotationProcessors;
import org.quiltmc.config.api.annotations.ConfigFieldAnnotationProcessor;
import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.loader.api.entrypoint.PreLaunchEntrypoint;

Expand All @@ -12,6 +12,6 @@ public class OkZoomerPreLaunchMod implements PreLaunchEntrypoint {
@Override
public void onPreLaunch(ModContainer mod) {
MixinExtrasBootstrap.init();
ConfigFieldAnnotationProcessors.register(WidgetSize.class, new WidgetSize.Processor());
ConfigFieldAnnotationProcessor.register(WidgetSize.class, new WidgetSize.Processor());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void init() {
}

if (ZoomPackets.getSpyglassDependency()) {
String key = switch (OkZoomerConfigManager.SPYGLASS_DEPENDENCY.value()) {
String key = switch (OkZoomerConfigManager.CONFIG.features.spyglass_dependency.value()) {
case REQUIRE_ITEM -> "command.ok_zoomer.restrictions.force_spyglass.require_item";
case REPLACE_ZOOM -> "command.ok_zoomer.restrictions.force_spyglass.replace_zoom";
case BOTH -> "command.ok_zoomer.restrictions.force_spyglass.both";
Expand Down
59 changes: 30 additions & 29 deletions src/main/java/io/github/ennuil/ok_zoomer/config/OkZoomerConfig.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package io.github.ennuil.ok_zoomer.config;

import org.quiltmc.config.api.WrappedConfig;
import org.quiltmc.config.api.ReflectiveConfig;
import org.quiltmc.config.api.annotations.Comment;
import org.quiltmc.config.api.annotations.FloatRange;
import org.quiltmc.config.api.annotations.IntegerRange;
import org.quiltmc.config.api.values.TrackedValue;

import io.github.ennuil.ok_zoomer.config.ConfigEnums.CinematicCameraOptions;
import io.github.ennuil.ok_zoomer.config.ConfigEnums.SpyglassDependency;
Expand All @@ -13,7 +14,7 @@
import io.github.ennuil.ok_zoomer.config.metadata.WidgetSize;
import io.github.ennuil.ok_zoomer.config.metadata.WidgetSize.Size;

public class OkZoomerConfig extends WrappedConfig {
public class OkZoomerConfig extends ReflectiveConfig {
@Comment("Contains the main zoom features.")
public final FeaturesConfig features = new FeaturesConfig();

Expand All @@ -23,19 +24,19 @@ public class OkZoomerConfig extends WrappedConfig {
@Comment("Contains options that are unlikely to be changed from the defaults.")
public final TweaksConfig tweaks = new TweaksConfig();

public class FeaturesConfig implements Section {
public static class FeaturesConfig extends Section {
@WidgetSize(Size.HALF)
@Comment("""
Defines the cinematic camera while zooming.
"OFF" disables the cinematic camera.
"VANILLA" uses Vanilla's cinematic camera.
"MULTIPLIED" is a multiplied variant of "VANILLA".
""")
public final CinematicCameraOptions cinematic_camera = CinematicCameraOptions.OFF;
public final TrackedValue<CinematicCameraOptions> cinematic_camera = this.value(CinematicCameraOptions.OFF);

@WidgetSize(Size.HALF)
@Comment("Reduces the mouse sensitivity when zooming.")
public final boolean reduce_sensitivity = true;
public final TrackedValue<Boolean> reduce_sensitivity = this.value(true);

@WidgetSize(Size.FULL)
@Comment("""
Expand All @@ -44,7 +45,7 @@ public class FeaturesConfig implements Section {
"SMOOTH" replicates Vanilla's dynamic FOV.
"LINEAR" removes the smoothiness.
""")
public final ZoomTransitionOptions zoom_transition = ZoomTransitionOptions.SMOOTH;
public final TrackedValue<ZoomTransitionOptions> zoom_transition = this.value(ZoomTransitionOptions.SMOOTH);

@WidgetSize(Size.HALF)
@Comment("""
Expand All @@ -53,15 +54,15 @@ public class FeaturesConfig implements Section {
"TOGGLE" has the zoom key toggle the zoom.
"PERSISTENT" makes the zoom permanent.
""")
public final ZoomModes zoom_mode = ZoomModes.HOLD;
public final TrackedValue<ZoomModes> zoom_mode = this.value(ZoomModes.HOLD);

@WidgetSize(Size.HALF)
@Comment("Allows to increase or decrease zoom by scrolling.")
public final boolean zoom_scrolling = true;
public final TrackedValue<Boolean> zoom_scrolling = this.value(true);

@WidgetSize(Size.HALF)
@Comment("Adds zoom manipulation keys along with the zoom key.")
public final boolean extra_key_binds = true;
public final TrackedValue<Boolean> extra_key_binds = this.value(true);

@WidgetSize(Size.HALF)
@Comment("""
Expand All @@ -70,7 +71,7 @@ public class FeaturesConfig implements Section {
"SPYGLASS" uses the spyglass overlay with the vignette texture.
The vignette texture can be found at: assets/ok_zoomer/textures/misc/zoom_overlay.png
""")
public final ZoomOverlays zoom_overlay = ZoomOverlays.OFF;
public final TrackedValue<ZoomOverlays> zoom_overlay = this.value(ZoomOverlays.OFF);

@WidgetSize(Size.FULL)
@Comment("""
Expand All @@ -80,91 +81,91 @@ public class FeaturesConfig implements Section {
"BOTH" will apply both options at the same time.
The "REQUIRE_ITEM" option is configurable through the ok_zoomer:zoom_dependencies item tag.
""")
public final SpyglassDependency spyglass_dependency = SpyglassDependency.OFF;
public final TrackedValue<SpyglassDependency> spyglass_dependency = this.value(SpyglassDependency.OFF);
}

public class ValuesConfig implements Section {
public static class ValuesConfig extends Section {
@WidgetSize(Size.FULL)
@Comment("The divisor applied to the FOV when zooming.")
@FloatRange(min = Double.MIN_NORMAL, max = Double.MAX_VALUE)
public final double zoom_divisor = 4.0;
public final TrackedValue<Double> zoom_divisor = this.value(4.0);

@WidgetSize(Size.HALF)
@Comment("The minimum value that you can scroll down.")
@FloatRange(min = Double.MIN_NORMAL, max = Double.MAX_VALUE)
public final double minimum_zoom_divisor = 1.0;
public final TrackedValue<Double> minimum_zoom_divisor = this.value(1.0);

@WidgetSize(Size.HALF)
@Comment("The maximum value that you can scroll down.")
@FloatRange(min = Double.MIN_NORMAL, max = Double.MAX_VALUE)
public final double maximum_zoom_divisor = 50.0;
public final TrackedValue<Double> maximum_zoom_divisor = this.value(50.0);

@WidgetSize(Size.HALF)
@Comment("""
The number of steps between the zoom divisor and the maximum zoom divisor.
Used by zoom scrolling.
""")
@IntegerRange(min = 0, max = Integer.MAX_VALUE)
public final int upper_scroll_steps = 10;
public final TrackedValue<Integer> upper_scroll_steps = this.value(10);

@WidgetSize(Size.HALF)
@Comment("""
The number of steps between the zoom divisor and the minimum zoom divisor.
Used by zoom scrolling.
""")
@IntegerRange(min = 0, max = Integer.MAX_VALUE)
public final int lower_scroll_steps = 5;
public final TrackedValue<Integer> lower_scroll_steps = this.value(5);

@WidgetSize(Size.HALF)
@Comment("The multiplier used for smooth transitions.")
@FloatRange(min = Double.MIN_NORMAL, max = 1.0)
public final double smooth_multiplier = 0.75;
public final TrackedValue<Double> smooth_multiplier = this.value(0.75);

@WidgetSize(Size.HALF)
@Comment("The multiplier used for the multiplied cinematic camera.")
@FloatRange(min = Double.MIN_NORMAL, max = 32.0)
public final double cinematic_multiplier = 4.0;
public final TrackedValue<Double> cinematic_multiplier = this.value(4.0);

@WidgetSize(Size.HALF)
@Comment("The minimum value which the linear transition step can reach.")
@FloatRange(min = 0.0, max = Double.MAX_VALUE)
public final double minimum_linear_step = 0.125;
public final TrackedValue<Double> minimum_linear_step = this.value(0.125);

@WidgetSize(Size.HALF)
@Comment("The maximum value which the linear transition step can reach.")
@FloatRange(min = 0.0, max = Double.MAX_VALUE)
public final double maximum_linear_step = 0.25;
public final TrackedValue<Double> maximum_linear_step = this.value(0.25);
}

public class TweaksConfig implements Section {
public static class TweaksConfig extends Section {
@WidgetSize(Size.HALF)
@Comment("Allows for resetting the zoom with the middle mouse button.")
public final boolean reset_zoom_with_mouse = true;
public final TrackedValue<Boolean> reset_zoom_with_mouse = this.value(true);

@WidgetSize(Size.HALF)
@Comment("If enabled, the current zoom divisor is forgotten once zooming is done.")
public final boolean forget_zoom_divisor = true;
public final TrackedValue<Boolean> forget_zoom_divisor = this.value(true);

@WidgetSize(Size.FULL)
@Comment("If pressed, the \"Save Toolbar Activator\" keybind will be unbound if there's a conflict with the zoom key.")
public final boolean unbind_conflicting_key = true;
public final TrackedValue<Boolean> unbind_conflicting_key = this.value(true);

@WidgetSize(Size.HALF)
@Comment("If enabled, the spyglass overlay texture is used instead of Ok Zoomer's overlay texture.")
public final boolean use_spyglass_texture = false;
public final TrackedValue<Boolean> use_spyglass_texture = this.value(false);

@WidgetSize(Size.HALF)
@Comment("If enabled, the zoom will use spyglass sounds on zooming in and out.")
public final boolean use_spyglass_sounds = false;
public final TrackedValue<Boolean> use_spyglass_sounds = this.value(false);

@WidgetSize(Size.HALF)
@Comment("Shows toasts when the server imposes a restriction.")
public final boolean show_restriction_toasts = true;
public final TrackedValue<Boolean> show_restriction_toasts = this.value(true);

// TODO - Revert default value on 5.0.0
@WidgetSize(Size.HALF)
@Comment("Prints a random owo in the console when the game starts. Enabled by default until full release.")
public final boolean print_owo_on_start = true;
public final TrackedValue<Boolean> print_owo_on_start = this.value(true);
}

// TODO - What if we had a secret Debug section?
Expand Down
Loading

0 comments on commit 5842f95

Please sign in to comment.