diff --git a/gradle.properties b/gradle.properties index 1663c02..fb3a3a2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ org.gradle.jvmargs = -Xmx1G org.gradle.parallel = true # Mod Properties -version = 5.0.1 +version = 5.0.2 maven_group = io.github.ennuil archives_base_name = ok_zoomer diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 908dc81..e9b5115 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,13 +1,13 @@ [versions] # Latest version is available at https://lambdaurora.dev/tools/import_quilt.html -minecraft = "1.20.1" -quilt_mappings = "1.20.1+build.23" +minecraft = "1.20.2" +quilt_mappings = "1.20.2+build.3" quilt_loader = "0.23.1" -quilted_fabric_api = "7.5.0+0.91.0-1.20.1" +quilted_fabric_api = "8.0.0-alpha.4+0.91.6-1.20.2" libzoomer = "0.8.0+1.20.1" -mod_menu = "7.2.2" -spruceui = "5.0.2+1.20" +mod_menu = "8.0.1" +spruceui = "5.0.3+1.20.2" [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/commands/OkZoomerCommandScreen.java b/src/main/java/io/github/ennuil/ok_zoomer/commands/OkZoomerCommandScreen.java index a7ae1a3..41fb56d 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/commands/OkZoomerCommandScreen.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/commands/OkZoomerCommandScreen.java @@ -94,8 +94,8 @@ protected void init() { ); } - this.addDrawableChild(list); - this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, this.height - 28), 200, 20, SpruceTexts.GUI_DONE, + this.addDrawableSelectableElement(list); + this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, this.height - 28), 200, 20, SpruceTexts.GUI_DONE, btn -> this.client.setScreen(null)).asVanilla()); } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/config/screen/OkZoomerConfigScreen.java b/src/main/java/io/github/ennuil/ok_zoomer/config/screen/OkZoomerConfigScreen.java index 888f71b..d65d561 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/config/screen/OkZoomerConfigScreen.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/config/screen/OkZoomerConfigScreen.java @@ -76,13 +76,13 @@ protected void init() { this.initializeOptionList(); this.appendPresetSection(); - this.addDrawableChild(this.list); - this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 154, this.height - 28), 150, 20, Text.translatable("config.ok_zoomer.discard_changes"), + this.addDrawableSelectableElement(this.list); + this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 154, this.height - 28), 150, 20, Text.translatable("config.ok_zoomer.discard_changes"), btn -> { this.resetNewValues(); this.refresh(); }).asVanilla()); - this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 + 4, this.height - 28), 150, 20, SpruceTexts.GUI_DONE, + this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 + 4, this.height - 28), 150, 20, SpruceTexts.GUI_DONE, btn -> { this.newValues.forEach((trackedValue, newValue) -> { if (trackedValue.value() != null) { @@ -301,8 +301,16 @@ public void resetToPreset(ZoomPresets preset) { }), Map.entry(OkZoomerConfigManager.CONFIG.values.minimum_zoom_divisor, 1.0D), Map.entry(OkZoomerConfigManager.CONFIG.values.maximum_zoom_divisor, 50.0D), - Map.entry(OkZoomerConfigManager.CONFIG.values.upper_scroll_steps, preset == ZoomPresets.SPYGLASS ? 16 : 20), - Map.entry(OkZoomerConfigManager.CONFIG.values.lower_scroll_steps, preset == ZoomPresets.SPYGLASS ? 8 : 4), + Map.entry(OkZoomerConfigManager.CONFIG.values.upper_scroll_steps, switch (preset) { + case PERSISTENT -> 38; + case SPYGLASS -> 16; + default -> 20; + }), + Map.entry(OkZoomerConfigManager.CONFIG.values.lower_scroll_steps, switch (preset) { + case PERSISTENT -> 0; + case SPYGLASS -> 8; + default -> 4; + }), Map.entry(OkZoomerConfigManager.CONFIG.values.smooth_multiplier, preset == ZoomPresets.SPYGLASS ? 0.5D : 0.75D), Map.entry(OkZoomerConfigManager.CONFIG.values.cinematic_multiplier, 4.0D), Map.entry(OkZoomerConfigManager.CONFIG.values.minimum_linear_step, 0.125D), diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/InGameHudMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/InGameHudMixin.java index 58ba540..5f9d8a6 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/InGameHudMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/InGameHudMixin.java @@ -2,11 +2,11 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import net.minecraft.client.gui.hud.in_game.InGameHud; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; -import net.minecraft.client.gui.hud.InGameHud; @Mixin(InGameHud.class) public abstract class InGameHudMixin { diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/MouseMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/MouseMixin.java index cc55b43..da25edd 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/MouseMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/MouseMixin.java @@ -2,6 +2,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Local; import org.lwjgl.glfw.GLFW; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -19,24 +20,21 @@ // This mixin is responsible for the mouse-behavior-changing part of the zoom @Mixin(Mouse.class) public abstract class MouseMixin { - @Shadow - private double scrollDelta; - // Handles zoom scrolling @Inject( method = "onMouseScroll", - at = @At(value = "FIELD", target = "Lnet/minecraft/client/Mouse;scrollDelta:D", ordinal = 7), + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSpectator()Z"), cancellable = true ) - private void zoomerOnMouseScroll(CallbackInfo ci) { - if (this.scrollDelta != 0.0) { + private void zoomerOnMouseScroll(CallbackInfo ci, @Local(ordinal = 2) int k) { + if (k != 0) { if (OkZoomerConfigManager.CONFIG.features.zoom_scrolling.value()) { if (OkZoomerConfigManager.CONFIG.features.zoom_mode.value().equals(ZoomModes.PERSISTENT)) { if (!ZoomKeyBinds.ZOOM_KEY.isPressed()) return; } if (ZoomUtils.ZOOMER_ZOOM.getZoom()) { - ZoomUtils.changeZoomDivisor(this.scrollDelta > 0.0); + ZoomUtils.changeZoomDivisor(k > 0); ci.cancel(); } }