diff --git a/build.gradle b/build.gradle index 87cffc3..bbb8689 100644 --- a/build.gradle +++ b/build.gradle @@ -59,8 +59,9 @@ loom { } } + // Mixin plugin needs this mixin { - useLegacyMixinAp = false + useLegacyMixinAp = true } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1e36e57..f1985f8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,10 +4,10 @@ minecraft = "1.21.1" parchment = "2024.07.28" quilt_loom = "1.7.4" -quilt_loader = "0.26.4+local" +quilt_loader = "0.26.4" fabric_api = "0.105.0+1.21.1" -wrench_wrapper = "0.4.0" +wrench_wrapper = "0.5.0" modmenu = "11.0.3" trinkets = "3.10.0" diff --git a/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerMixinPlugin.java b/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerMixinPlugin.java new file mode 100644 index 0000000..4ad5808 --- /dev/null +++ b/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerMixinPlugin.java @@ -0,0 +1,61 @@ +package io.github.ennuil.ok_zoomer; + +import net.fabricmc.loader.api.FabricLoader; +import org.objectweb.asm.tree.ClassNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; + +// TODO - Demolish this mixin plugin by doing a real port! +public class OkZoomerMixinPlugin implements IMixinConfigPlugin { + private static final Logger LOGGER = LoggerFactory.getLogger("Ok Zoomer Mixins"); + private static String mixinPackage; + + @Override + public void onLoad(String mixinPackage) { + OkZoomerMixinPlugin.mixinPackage = mixinPackage; + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + if (mixinClassName.startsWith(mixinPackage)) { + var id = mixinClassName.substring(mixinPackage.length()); + id = id.substring(1, id.indexOf('.', 1)); + + boolean connectorLoaded = FabricLoader.getInstance().isModLoaded("connector"); + if (id.equals("sintyra") && connectorLoaded) { + LOGGER.warn("Loaded Sintyra-specific mixins!"); + return true; + } else if (id.equals("fabric")) { + return !connectorLoaded; + } + + return id.equals("common"); + } + + return true; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) {} + + @Override + public List getMixins() { + return null; + } + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} +} diff --git a/src/main/java/io/github/ennuil/ok_zoomer/config/OkZoomerConfig.java b/src/main/java/io/github/ennuil/ok_zoomer/config/OkZoomerConfig.java index ec2b190..6d8db04 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/config/OkZoomerConfig.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/config/OkZoomerConfig.java @@ -57,6 +57,10 @@ public static class FeaturesConfig extends Section { @Comment("Allows to increase or decrease the zoom by scrolling with the mouse wheel.") public final TrackedValue zoomScrolling = this.value(true); + @WidgetSize(Size.HALF) + @Comment("Retains the interface when zooming.") + public final TrackedValue persistentInterface = this.value(false); + @WidgetSize(Size.HALF) @Comment("Adds zoom manipulation keys along with the zoom key. A game reboot will be required in order to apply the changes.") public final TrackedValue extraKeyBinds = this.value(true); @@ -135,6 +139,10 @@ public static class TweaksConfig extends Section { @Comment("If pressed, the \"Save Toolbar Activator\" keybind will be unbound if there's a conflict with the zoom key.") public final TrackedValue unbindConflictingKey = this.value(true); + @WidgetSize(Size.HALF) + @Comment("Hides the crosshair while zooming.") + public final TrackedValue hideCrosshair = this.value(true); + @WidgetSize(Size.HALF) @Comment("Allows for resetting the zoom with the middle mouse button.") public final TrackedValue resetZoomWithMouse = this.value(true); @@ -151,10 +159,10 @@ public static class TweaksConfig extends Section { @Comment("Shows toasts when the server imposes a restriction.") public final TrackedValue showRestrictionToasts = this.value(true); - // TODO - Enable it again during eternal betas! + // TODO - Disable it upon stable release! @WidgetSize(Size.HALF) @Comment("Prints a random owo in the console when the game starts.") - public final TrackedValue printOwoOnStart = this.value(false); + public final TrackedValue printOwoOnStart = this.value(true); } // TODO - What if we had a secret Debug section? 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 78dd734..c88dc23 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 @@ -269,6 +269,7 @@ public void resetToPreset(ConfigEnums.ZoomPresets preset) { case CLASSIC, SPYGLASS -> false; default -> true; }), + Map.entry(OkZoomerConfigManager.CONFIG.features.persistentInterface, preset != ConfigEnums.ZoomPresets.DEFAULT), Map.entry(OkZoomerConfigManager.CONFIG.features.extraKeyBinds, preset != ConfigEnums.ZoomPresets.CLASSIC), Map.entry(OkZoomerConfigManager.CONFIG.features.zoomOverlay, preset == ConfigEnums.ZoomPresets.SPYGLASS ? ConfigEnums.ZoomOverlays.SPYGLASS : ConfigEnums.ZoomOverlays.OFF), Map.entry(OkZoomerConfigManager.CONFIG.features.spyglassMode, preset == ConfigEnums.ZoomPresets.SPYGLASS ? ConfigEnums.SpyglassMode.BOTH : ConfigEnums.SpyglassMode.OFF), @@ -298,11 +299,12 @@ public void resetToPreset(ConfigEnums.ZoomPresets preset) { Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.minimumLinearStep, 0.16D), Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.maximumLinearStep, 0.22D), Map.entry(OkZoomerConfigManager.CONFIG.tweaks.resetZoomWithMouse, preset != ConfigEnums.ZoomPresets.CLASSIC), + Map.entry(OkZoomerConfigManager.CONFIG.tweaks.hideCrosshair, preset == ConfigEnums.ZoomPresets.DEFAULT), Map.entry(OkZoomerConfigManager.CONFIG.tweaks.forgetZoomDivisor, true), Map.entry(OkZoomerConfigManager.CONFIG.tweaks.unbindConflictingKey, false), Map.entry(OkZoomerConfigManager.CONFIG.tweaks.useSpyglassSounds, preset == ConfigEnums.ZoomPresets.SPYGLASS), Map.entry(OkZoomerConfigManager.CONFIG.tweaks.showRestrictionToasts, true), - Map.entry(OkZoomerConfigManager.CONFIG.tweaks.printOwoOnStart, false) + Map.entry(OkZoomerConfigManager.CONFIG.tweaks.printOwoOnStart, true) ); this.newValues.clear(); diff --git a/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/LabelledEditBox.java b/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/LabelledEditBox.java index abee899..481d0f8 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/LabelledEditBox.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/LabelledEditBox.java @@ -1,6 +1,6 @@ package io.github.ennuil.ok_zoomer.config.screen.components; -import io.github.ennuil.ok_zoomer.mixin.EditBoxAccessor; +import io.github.ennuil.ok_zoomer.mixin.common.EditBoxAccessor; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.EditBox; diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/GuiMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/GuiMixin.java deleted file mode 100644 index 5508570..0000000 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/GuiMixin.java +++ /dev/null @@ -1,59 +0,0 @@ -package io.github.ennuil.ok_zoomer.mixin; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.sugar.Share; -import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; -import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; -import io.github.ennuil.ok_zoomer.zoom.Zoom; -import net.minecraft.client.DeltaTracker; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiGraphics; -import org.quiltmc.loader.api.minecraft.ClientOnly; -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; - -@ClientOnly -@Mixin(Gui.class) -public abstract class GuiMixin { - @Inject( - method = "renderCameraOverlays", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/DeltaTracker;getGameTimeDeltaTicks()F" - ) - ) - private void injectZoomOverlay(GuiGraphics graphics, DeltaTracker deltaTracker, CallbackInfo ci, @Share("cancelOverlay") LocalBooleanRef cancelOverlay) { - cancelOverlay.set(false); - if (Zoom.getZoomOverlay() != null) { - var overlay = Zoom.getZoomOverlay(); - overlay.tickBeforeRender(); - if (overlay.getActive()) { - cancelOverlay.set(overlay.cancelOverlayRendering()); - overlay.renderOverlay(graphics); - } - } - } - - // Cancel the cancellable overlays - @ModifyExpressionValue(method = "renderCameraOverlays", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/CameraType;isFirstPerson()Z")) - private boolean cancelOverlay(boolean original, @Share("cancelOverlay") LocalBooleanRef cancelOverlay) { - return original && !cancelOverlay.get(); - } - - @ModifyExpressionValue( - method = "renderCameraOverlays", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isScoping()Z") - ) - private boolean activateSpyglassOverlay(boolean isScoping) { - if (switch (OkZoomerConfigManager.CONFIG.features.spyglassMode.value()) { - case REPLACE_ZOOM, BOTH -> true; - default -> false; - }) { - return false; - } - - return isScoping; - } -} diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/AbstractClientPlayerMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/AbstractClientPlayerMixin.java similarity index 94% rename from src/main/java/io/github/ennuil/ok_zoomer/mixin/AbstractClientPlayerMixin.java rename to src/main/java/io/github/ennuil/ok_zoomer/mixin/common/AbstractClientPlayerMixin.java index 3b7a503..73c8fb0 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/AbstractClientPlayerMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/AbstractClientPlayerMixin.java @@ -1,4 +1,4 @@ -package io.github.ennuil.ok_zoomer.mixin; +package io.github.ennuil.ok_zoomer.mixin.common; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/EditBoxAccessor.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/EditBoxAccessor.java similarity index 87% rename from src/main/java/io/github/ennuil/ok_zoomer/mixin/EditBoxAccessor.java rename to src/main/java/io/github/ennuil/ok_zoomer/mixin/common/EditBoxAccessor.java index 09786ba..5a88e20 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/EditBoxAccessor.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/EditBoxAccessor.java @@ -1,4 +1,4 @@ -package io.github.ennuil.ok_zoomer.mixin; +package io.github.ennuil.ok_zoomer.mixin.common; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.components.EditBox; diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/EditBoxMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/EditBoxMixin.java similarity index 96% rename from src/main/java/io/github/ennuil/ok_zoomer/mixin/EditBoxMixin.java rename to src/main/java/io/github/ennuil/ok_zoomer/mixin/common/EditBoxMixin.java index 7c59a06..28257bb 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/EditBoxMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/EditBoxMixin.java @@ -1,4 +1,4 @@ -package io.github.ennuil.ok_zoomer.mixin; +package io.github.ennuil.ok_zoomer.mixin.common; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import io.github.ennuil.ok_zoomer.config.screen.components.LabelledEditBox; diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/GameRendererMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GameRendererMixin.java similarity index 95% rename from src/main/java/io/github/ennuil/ok_zoomer/mixin/GameRendererMixin.java rename to src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GameRendererMixin.java index 54f0780..fcf2086 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/GameRendererMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GameRendererMixin.java @@ -1,4 +1,4 @@ -package io.github.ennuil.ok_zoomer.mixin; +package io.github.ennuil.ok_zoomer.mixin.common; import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef; @@ -25,7 +25,7 @@ private void tickInstances(CallbackInfo info) { Zoom.getMouseModifier().tick(zooming); } if (Zoom.getZoomOverlay() != null) { - Zoom.getZoomOverlay().tick(zooming, divisor, Zoom.getTransitionMode().getInternalMultiplier()); + Zoom.getZoomOverlay().tick(zooming, divisor, Zoom.getTransitionMode()); } } } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GuiMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GuiMixin.java new file mode 100644 index 0000000..bf59685 --- /dev/null +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GuiMixin.java @@ -0,0 +1,110 @@ +package io.github.ennuil.ok_zoomer.mixin.common; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; +import com.mojang.blaze3d.systems.RenderSystem; +import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; +import io.github.ennuil.ok_zoomer.zoom.Zoom; +import net.minecraft.client.DeltaTracker; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiGraphics; +import org.quiltmc.loader.api.minecraft.ClientOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@ClientOnly +@Mixin(Gui.class) +public abstract class GuiMixin { + @Unique + private boolean hideCrossbar = false; + + @Shadow + protected abstract void renderCrosshair(GuiGraphics guiGraphics, DeltaTracker deltaTracker); + + @Inject( + method = "renderCameraOverlays", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/DeltaTracker;getGameTimeDeltaTicks()F" + ) + ) + private void injectZoomOverlay(GuiGraphics graphics, DeltaTracker deltaTracker, CallbackInfo ci, @Share("cancelOverlay") LocalBooleanRef cancelOverlay) { + cancelOverlay.set(false); + if (Zoom.getZoomOverlay() != null) { + var overlay = Zoom.getZoomOverlay(); + overlay.tickBeforeRender(deltaTracker); + if (overlay.getActive()) { + cancelOverlay.set(overlay.cancelOverlayRendering()); + overlay.renderOverlay(graphics, deltaTracker, Zoom.getTransitionMode()); + } + } + } + + // Cancel the cancellable overlays + @ModifyExpressionValue(method = "renderCameraOverlays", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/CameraType;isFirstPerson()Z")) + private boolean cancelOverlay(boolean original, @Share("cancelOverlay") LocalBooleanRef cancelOverlay) { + return original && !cancelOverlay.get(); + } + + @ModifyExpressionValue( + method = "renderCameraOverlays", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isScoping()Z") + ) + private boolean activateSpyglassOverlay(boolean isScoping) { + if (switch (OkZoomerConfigManager.CONFIG.features.spyglassMode.value()) { + case REPLACE_ZOOM, BOTH -> true; + default -> false; + }) { + return false; + } + + return isScoping; + } + + @WrapMethod(method = "render") + private void zoomGui(GuiGraphics graphics, DeltaTracker deltaTracker, Operation original) { + if (OkZoomerConfigManager.CONFIG.features.persistentInterface.value() || !Zoom.getTransitionMode().getActive()) { + original.call(graphics, deltaTracker); + } else { + hideCrossbar = false; + if (!OkZoomerConfigManager.CONFIG.tweaks.hideCrosshair.value()) { + graphics.pose().pushPose(); + graphics.pose().translate(0.0F, 0.0F, 200.0F); + this.renderCrosshair(graphics, deltaTracker); + graphics.pose().popPose(); + hideCrossbar = true; + } + double fov = Zoom.getTransitionMode().applyZoom(1.0F, deltaTracker.getGameTimeDeltaPartialTick(true)); + float divisor = (float) (1.0D / fov); + double translation = 2.0D / ((1.0D / fov) - 1); + graphics.pose().pushPose(); + graphics.pose().translate(-(graphics.guiWidth() / (translation)), -(graphics.guiHeight() / (translation)), 0.0F); + graphics.pose().scale(divisor, divisor, divisor); + original.call(graphics, deltaTracker); + graphics.pose().popPose(); + } + } + + @WrapMethod(method = "renderCrosshair") + private void hideCrosshair(GuiGraphics graphics, DeltaTracker deltaTracker, Operation original) { + if (!hideCrossbar) { + if (!OkZoomerConfigManager.CONFIG.tweaks.hideCrosshair.value() || !Zoom.getTransitionMode().getActive()) { + original.call(graphics, deltaTracker); + } else { + float fade = 1.0F - (float) Zoom.getTransitionMode().getFade(deltaTracker.getGameTimeDeltaPartialTick(true)); + RenderSystem.setShaderColor(fade, fade, fade, 1.0F); + original.call(graphics, deltaTracker); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + } + } else { + hideCrossbar = false; + } + } +} diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/MouseHandlerMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/MouseHandlerMixin.java similarity index 76% rename from src/main/java/io/github/ennuil/ok_zoomer/mixin/MouseHandlerMixin.java rename to src/main/java/io/github/ennuil/ok_zoomer/mixin/common/MouseHandlerMixin.java index f58a3a2..5d36cff 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/MouseHandlerMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/MouseHandlerMixin.java @@ -1,8 +1,7 @@ -package io.github.ennuil.ok_zoomer.mixin; +package io.github.ennuil.ok_zoomer.mixin.common; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.sugar.Local; -import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef; import io.github.ennuil.ok_zoomer.zoom.Zoom; import io.github.ennuil.ok_zoomer.config.ConfigEnums.ZoomModes; import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; @@ -20,23 +19,6 @@ @ClientOnly @Mixin(MouseHandler.class) public abstract class MouseHandlerMixin { - // Handles zooming - @Inject( - method = "turnPlayer", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/Options;invertYMouse()Lnet/minecraft/client/OptionInstance;" - ) - ) - public void applyZoomChanges(double movementTime, CallbackInfo ci, @Local(ordinal = 1) LocalDoubleRef i, @Local(ordinal = 2) LocalDoubleRef j, @Local(ordinal = 5) double f) { - if (Zoom.isModifierActive()) { - double zoomDivisor = Zoom.isZooming() ? Zoom.getZoomDivisor() : 1.0; - double transitionDivisor = Zoom.getTransitionMode().getInternalMultiplier(); - i.set(Zoom.getMouseModifier().applyXModifier(i.get(), f, movementTime, zoomDivisor, transitionDivisor)); - j.set(Zoom.getMouseModifier().applyYModifier(j.get(), f, movementTime, zoomDivisor, transitionDivisor)); - } - } - // Handles zoom scrolling @Inject( method = "onScroll", diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/fabric/MouseHandlerMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/fabric/MouseHandlerMixin.java new file mode 100644 index 0000000..ad037e9 --- /dev/null +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/fabric/MouseHandlerMixin.java @@ -0,0 +1,30 @@ +package io.github.ennuil.ok_zoomer.mixin.fabric; + +import com.llamalad7.mixinextras.sugar.Local; +import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef; +import io.github.ennuil.ok_zoomer.zoom.Zoom; +import net.minecraft.client.MouseHandler; +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; + +@Mixin(MouseHandler.class) +public abstract class MouseHandlerMixin { + @Inject( + method = "turnPlayer", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/Options;invertYMouse()Lnet/minecraft/client/OptionInstance;" + ), + require = 1 + ) + public void applyZoomChanges(double movementTime, CallbackInfo ci, @Local(ordinal = 1) LocalDoubleRef j, @Local(ordinal = 2) LocalDoubleRef k, @Local(ordinal = 5) double f) { + if (Zoom.isModifierActive()) { + double zoomDivisor = Zoom.isZooming() ? Zoom.getZoomDivisor() : 1.0; + double transitionDivisor = Zoom.getTransitionMode().getInternalMultiplier(); + j.set(Zoom.getMouseModifier().applyXModifier(j.get(), f, movementTime, zoomDivisor, transitionDivisor)); + k.set(Zoom.getMouseModifier().applyYModifier(k.get(), f, movementTime, zoomDivisor, transitionDivisor)); + } + } +} diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/sintyra/MouseHandlerMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/sintyra/MouseHandlerMixin.java new file mode 100644 index 0000000..1526a87 --- /dev/null +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/sintyra/MouseHandlerMixin.java @@ -0,0 +1,30 @@ +package io.github.ennuil.ok_zoomer.mixin.sintyra; + +import com.llamalad7.mixinextras.sugar.Local; +import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef; +import io.github.ennuil.ok_zoomer.zoom.Zoom; +import net.minecraft.client.MouseHandler; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Group; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MouseHandler.class) +public abstract class MouseHandlerMixin { + @Inject( + method = "turnPlayer", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/Options;invertYMouse()Lnet/minecraft/client/OptionInstance;" + ) + ) + public void applyZoomChanges(CallbackInfo ci, @Local(argsOnly = true) double movementTime, @Local(ordinal = 4) LocalDoubleRef j, @Local(ordinal = 5) LocalDoubleRef k, @Local(ordinal = 1) double f) { + if (Zoom.isModifierActive()) { + double zoomDivisor = Zoom.isZooming() ? Zoom.getZoomDivisor() : 1.0; + double transitionDivisor = Zoom.getTransitionMode().getInternalMultiplier(); + j.set(Zoom.getMouseModifier().applyXModifier(j.get(), f, movementTime, zoomDivisor, transitionDivisor)); + k.set(Zoom.getMouseModifier().applyYModifier(k.get(), f, movementTime, zoomDivisor, transitionDivisor)); + } + } +} diff --git a/src/main/java/io/github/ennuil/ok_zoomer/utils/ZoomUtils.java b/src/main/java/io/github/ennuil/ok_zoomer/utils/ZoomUtils.java index 297d0e4..9bced6f 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/utils/ZoomUtils.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/utils/ZoomUtils.java @@ -37,7 +37,7 @@ public class ZoomUtils { private static boolean openCommandScreen = false; - private static Predicate hasSpyglass = player -> player.getInventory().contains(IS_VALID_SPYGLASS); + private static Predicate hasSpyglass = player -> player.getInventory().contains(IS_VALID_SPYGLASS) || player.isCreative(); // The method used for changing the zoom divisor, used by zoom scrolling and the key binds public static void changeZoomDivisor(boolean increase) { diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/modifiers/MouseModifier.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/modifiers/MouseModifier.java index 0b5350e..45a4622 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/modifiers/MouseModifier.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/modifiers/MouseModifier.java @@ -1,44 +1,14 @@ package io.github.ennuil.ok_zoomer.zoom.modifiers; /** - * The mouse modifier is the sub-instance that handles any change of behavior of the mouse. + * The mouse modifier is the component that handles any change of behavior of the mouse. */ public interface MouseModifier { - /** - * Gets the active state of the mouse modifier. - * - * @return the mouse modifier's active state - */ boolean getActive(); - /** - * Modifies the cursor's X delta to the value returned on this method. - * - * @param cursorSensitivity the cursor sensitivity that is applied to the cursor delta - * @param cursorDeltaX the X delta after the calculations - * @param mouseUpdateTimeDelta the delta of the mouse update time - * @param targetDivisor the current zoom divisor - * @param transitionMultiplier the transition mode's internal multiplier - * @return the X delta that will replace the cursor's one - */ double applyXModifier(double cursorDeltaX, double cursorSensitivity, double mouseUpdateTimeDelta, double targetDivisor, double transitionMultiplier); - /** - * Modifies the cursor's Y delta to the value returned on this method. - * - * @param cursorSensitivity the cursor sensitivity that is applied to the cursor delta - * @param cursorDeltaY the Y delta after the calculations - * @param mouseUpdateTimeDelta the delta of the mouse update time - * @param targetDivisor the current zoom divisor - * @param transitionMultiplier the transition mode's internal multiplier - * @return the Y delta that will replace the cursor's Y delta - */ double applyYModifier(double cursorDeltaY, double cursorSensitivity, double mouseUpdateTimeDelta, double targetDivisor, double transitionMultiplier); - - /** - * The tick method. Used in order to keep the internal variables accurate. - * - * @param active the zoom state - */ + void tick(boolean active); } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/SpyglassZoomOverlay.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/SpyglassZoomOverlay.java index d0462f3..7562c7c 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/SpyglassZoomOverlay.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/SpyglassZoomOverlay.java @@ -1,6 +1,8 @@ package io.github.ennuil.ok_zoomer.zoom.overlays; import com.mojang.blaze3d.systems.RenderSystem; +import io.github.ennuil.ok_zoomer.zoom.transitions.TransitionMode; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.RenderType; @@ -8,25 +10,18 @@ import net.minecraft.util.CommonColors; import net.minecraft.util.Mth; -/** - * An implementation of the spyglass overlay as a zoom overlay - */ +// An implementation of the spyglass overlay as a zoom overlay public class SpyglassZoomOverlay implements ZoomOverlay { private final ResourceLocation textureId; - private Minecraft minecraft; + //private Minecraft minecraft; private float scale; private boolean active; - /** - * Initializes an instance of the spyglass mouse modifier with the specified texture identifier - * - * @param textureId the texture identifier for the spyglass overlay - */ public SpyglassZoomOverlay(ResourceLocation textureId) { this.textureId = textureId; this.scale = 0.5F; this.active = false; - this.ensureClient(); + //this.minecraft = Minecraft.getInstance(); } @Override @@ -39,8 +34,9 @@ public boolean cancelOverlayRendering() { return true; } + // TODO - Consider whenever a third-person view block tweak option is desirable @Override - public void renderOverlay(GuiGraphics graphics) { + public void renderOverlay(GuiGraphics graphics, DeltaTracker deltaTracker, TransitionMode transitionMode) { int guiWidth = graphics.guiWidth(); int guiHeight = graphics.guiHeight(); float smallerLength = (float) Math.min(guiWidth, guiHeight); @@ -61,26 +57,16 @@ public void renderOverlay(GuiGraphics graphics) { } @Override - public void tick(boolean active, double divisor, double transitionMultiplier) { + public void tick(boolean active, double divisor, TransitionMode transitionMode) { this.active = active; } @Override - public void tickBeforeRender() { - this.ensureClient(); - if (this.minecraft.options.getCameraType().isFirstPerson()) { - if (!this.active) { - this.scale = 0.5F; - } else { - float lastFrameDuration = this.minecraft.getTimer().getGameTimeDeltaTicks(); - this.scale = Mth.lerp(0.5F * lastFrameDuration, this.scale, 1.125F); - } - } - } - - private void ensureClient() { - if (this.minecraft == null) { - this.minecraft = Minecraft.getInstance(); + public void tickBeforeRender(DeltaTracker deltaTracker) { + if (!this.active) { + this.scale = 0.5F; + } else { + this.scale = Mth.lerp(0.5F * deltaTracker.getGameTimeDeltaTicks(), this.scale, 1.125F); } - } + } } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomOverlay.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomOverlay.java index e212f6e..16297ed 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomOverlay.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomOverlay.java @@ -1,46 +1,20 @@ package io.github.ennuil.ok_zoomer.zoom.overlays; +import io.github.ennuil.ok_zoomer.zoom.transitions.TransitionMode; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.gui.GuiGraphics; /** - * The zoom overlay is a sub-instance that handles the rendering of an overlay. + * The zoom overlay is the component that handles the rendering of an overlay. */ public interface ZoomOverlay { - /** - * Gets the active state of the zoom overlay. - * - * @return the zoom overlay's active state - */ boolean getActive(); - /** - * Determines if the zoom overlay should cancel the rendering of anything rendered after that. - * By default, it returns {@code false}. - * - * @return the state that will be used in order to cancel the rendering or not - */ default boolean cancelOverlayRendering() { return false; } - /** - * Renders the overlay itself. It's injected by LibZoomer itself. - * - * @param graphics the in-game HUD's graphics - */ - void renderOverlay(GuiGraphics graphics); + void renderOverlay(GuiGraphics graphics, DeltaTracker deltaTracker, TransitionMode transitionMode); - /** - * The tick method. Used in order to keep the internal variables accurate and the overlay functional. - * - * @param active the zoom state - * @param divisor the zoom divisor - * @param transitionMultiplier the transition mode's internal multiplier - */ - void tick(boolean active, double divisor, double transitionMultiplier); + void tick(boolean active, double divisor, TransitionMode transitionMode); - /** - * The tick method used right before the overlay is rendered. - *

- * This isn't required to be implemented. - */ - default void tickBeforeRender() {} + default void tickBeforeRender(DeltaTracker deltaTracker) {} } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomerZoomOverlay.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomerZoomOverlay.java index 7129e14..6583840 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomerZoomOverlay.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/overlays/ZoomerZoomOverlay.java @@ -4,6 +4,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import io.github.ennuil.ok_zoomer.config.ConfigEnums.ZoomTransitionOptions; import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; +import io.github.ennuil.ok_zoomer.zoom.transitions.TransitionMode; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; @@ -13,15 +15,10 @@ public class ZoomerZoomOverlay implements ZoomOverlay { private final ResourceLocation textureId; private boolean active; - private final Minecraft minecraft; - - public float zoomOverlayAlpha = 0.0F; - public float lastZoomOverlayAlpha = 0.0F; public ZoomerZoomOverlay(ResourceLocation textureId) { this.textureId = textureId; this.active = false; - this.minecraft = Minecraft.getInstance(); } @Override @@ -30,13 +27,13 @@ public boolean getActive() { } @Override - public void renderOverlay(GuiGraphics graphics) { + public void renderOverlay(GuiGraphics graphics, DeltaTracker deltaTracker, TransitionMode transitionMode) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - float lerpedOverlayAlpha = Mth.lerp(this.minecraft.getTimer().getGameTimeDeltaPartialTick(true), this.lastZoomOverlayAlpha, this.zoomOverlayAlpha); - RenderSystem.setShaderColor(lerpedOverlayAlpha, lerpedOverlayAlpha, lerpedOverlayAlpha, 1.0F); + float fade = (float) transitionMode.getFade(deltaTracker.getGameTimeDeltaPartialTick(true)); + RenderSystem.setShaderColor(fade, fade, fade, 1.0F); graphics.blit(this.textureId, 0, 0, -90, 0.0F, 0.0F, graphics.guiWidth(), graphics.guiHeight(), graphics.guiWidth(), graphics.guiHeight()); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); @@ -46,36 +43,9 @@ public void renderOverlay(GuiGraphics graphics) { } @Override - public void tick(boolean active, double divisor, double transitionMultiplier) { - if (active || zoomOverlayAlpha == 0.0F) { + public void tick(boolean active, double divisor, TransitionMode transitionMode) { + if (active) { this.active = active; } - - /* - Due to how LibZoomer is implemented, it's always going to disappear when the HUD's hidden, - this is not good for cinematic purposes... - // TODO - Restore this feature - if (this.client.options.hudHidden) { - if (OkZoomerConfigPojo.tweaks.hideZoomOverlay) { - return; - } - } - */ - - float zoomMultiplier = active ? 1.0F : 0.0F; - - lastZoomOverlayAlpha = zoomOverlayAlpha; - - if (OkZoomerConfigManager.CONFIG.features.zoomTransition.value().equals(ZoomTransitionOptions.SMOOTH)) { - zoomOverlayAlpha += (float) ((zoomMultiplier - zoomOverlayAlpha) * OkZoomerConfigManager.CONFIG.transitionValues.smoothTransitionFactor.value()); - } else if (OkZoomerConfigManager.CONFIG.features.zoomTransition.value().equals(ZoomTransitionOptions.LINEAR)) { - double linearStep = Mth.clamp( - 1.0F / divisor, - OkZoomerConfigManager.CONFIG.transitionValues.minimumLinearStep.value(), - OkZoomerConfigManager.CONFIG.transitionValues.maximumLinearStep.value() - ); - - zoomOverlayAlpha = Mth.approach(zoomOverlayAlpha, zoomMultiplier, (float) linearStep); - } } } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/InstantTransitionMode.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/InstantTransitionMode.java index 4c1e97b..14c684b 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/InstantTransitionMode.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/InstantTransitionMode.java @@ -1,15 +1,9 @@ package io.github.ennuil.ok_zoomer.zoom.transitions; -/** - * An implementation of a simple zoom as a transition mode. - */ public class InstantTransitionMode implements TransitionMode { private boolean active; private double divisor; - /** - * Initializes an instance of the instant transition mode. - */ public InstantTransitionMode() { this.active = false; this.divisor = 1.0; @@ -25,6 +19,11 @@ public double applyZoom(double fov, float tickDelta) { return fov / this.divisor; } + @Override + public double getFade(float tickDelta) { + return this.active ? 1.0 : 0.0; + } + @Override public void tick(boolean active, double divisor) { this.active = active; diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/LinearTransitionMode.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/LinearTransitionMode.java index 64d7c4c..e9f8dcb 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/LinearTransitionMode.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/LinearTransitionMode.java @@ -10,6 +10,8 @@ public class LinearTransitionMode implements TransitionMode { private double fovMultiplier; private float internalMultiplier; private float lastInternalMultiplier; + private float internalFade; + private float lastInternalFade; public LinearTransitionMode(double minimumLinearStep, double maximumLinearStep) { this.active = false; @@ -17,6 +19,8 @@ public LinearTransitionMode(double minimumLinearStep, double maximumLinearStep) this.maximumLinearStep = maximumLinearStep; this.internalMultiplier = 1.0F; this.lastInternalMultiplier = 1.0F; + this.internalFade = 0.0F; + this.lastInternalFade = 0.0F; } @Override @@ -30,14 +34,22 @@ public double applyZoom(double fov, float tickDelta) { return fov * fovMultiplier; } - @Override + @Override + public double getFade(float tickDelta) { + return Mth.lerp(tickDelta, this.lastInternalFade, this.internalFade); + } + + @Override public void tick(boolean active, double divisor) { - double zoomMultiplier = 1.0D / divisor; + double zoomMultiplier = 1.0 / divisor; + double fadeMultiplier = active ? 1.0D : 0.0D; - this.lastInternalMultiplier = this.internalMultiplier; + this.lastInternalMultiplier = this.internalMultiplier; + this.lastInternalFade = this.internalFade; double linearStep = Mth.clamp(zoomMultiplier, this.minimumLinearStep, this.maximumLinearStep); - this.internalMultiplier = Mth.approach(this.internalMultiplier, (float)zoomMultiplier, (float)linearStep); + this.internalMultiplier = Mth.approach(this.internalMultiplier, (float) zoomMultiplier, (float) linearStep); + this.internalFade = Mth.approach(this.internalFade, (float) fadeMultiplier, (float) linearStep); if (active || fovMultiplier == this.internalMultiplier) { this.active = active; diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/SmoothTransitionMode.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/SmoothTransitionMode.java index 3e5216b..4cb5ae9 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/SmoothTransitionMode.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/SmoothTransitionMode.java @@ -2,31 +2,24 @@ import net.minecraft.util.Mth; -/** - * An implementation of Ok Zoomer's smooth transitions (and Vanilla's spyglass zoom) as a transition mode - */ public class SmoothTransitionMode implements TransitionMode { private boolean active; private final float smoothMultiplier; private double fovMultiplier; private float internalMultiplier; private float lastInternalMultiplier; + private float internalFade; + private float lastInternalFade; - /** - * Initializes an instance of the smooth transition mode with the specified smooth multiplier - * - * @param smoothMultiplier the smooth multiplier, used internally by the smooth transition - */ public SmoothTransitionMode(float smoothMultiplier) { this.active = false; this.smoothMultiplier = smoothMultiplier; this.internalMultiplier = 1.0F; this.lastInternalMultiplier = 1.0F; + this.internalFade = 0.0F; + this.lastInternalFade = 0.0F; } - /** - * Initializes an instance of the smooth transition mode with the smooth multiplier being {@code 0.5F} - */ public SmoothTransitionMode() { this(0.5F); } @@ -42,13 +35,21 @@ public double applyZoom(double fov, float tickDelta) { return fov * fovMultiplier; } + @Override + public double getFade(float tickDelta) { + return Mth.lerp(tickDelta, this.lastInternalFade, this.internalFade); + } + @Override public void tick(boolean active, double divisor) { - double zoomMultiplier = 1.0F / divisor; + double zoomMultiplier = 1.0 / divisor; + double fadeMultiplier = active ? 1.0 : 0.0; this.lastInternalMultiplier = this.internalMultiplier; + this.lastInternalFade = this.internalFade; - this.internalMultiplier += (float) ((zoomMultiplier - internalMultiplier) * smoothMultiplier); + this.internalMultiplier += (float) ((zoomMultiplier - this.internalMultiplier) * this.smoothMultiplier); + this.internalFade += (float) ((fadeMultiplier - this.internalFade) * this.smoothMultiplier); if (active || fovMultiplier == this.internalMultiplier) { this.active = active; diff --git a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/TransitionMode.java b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/TransitionMode.java index a4ef102..82de8e7 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/TransitionMode.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/zoom/transitions/TransitionMode.java @@ -1,38 +1,17 @@ package io.github.ennuil.ok_zoomer.zoom.transitions; /** - * The transition mode is a sub-instance that handles zooming itself. + * The transition mode is the component that handles zooming itself. * It handles how the regular FOV will transition to the zoomed FOV and vice-versa. */ public interface TransitionMode { - /** - * Gets the active state of the transition mode. - * - * @return the transition mode's active state - */ boolean getActive(); - /** - * Applies the zoom to the FOV. - * - * @param fov the original FOV - * @param tickDelta the current tick delta - * @return the zoomed FOV - */ double applyZoom(double fov, float tickDelta); - /** - * The tick method. Used in order to keep the internal variables accurate. - * - * @param active the zoom state - * @param divisor the zoom divisor - */ + double getFade(float tickDelta); + void tick(boolean active, double divisor); - /** - * Gets the internal multiplier. Used for purposes other than zooming the FOV. - * - * @return the internal multiplier - */ double getInternalMultiplier(); } diff --git a/src/main/resources/assets/ok_zoomer/lang/en_us.json b/src/main/resources/assets/ok_zoomer/lang/en_us.json index 73341e6..2b3d3cb 100644 --- a/src/main/resources/assets/ok_zoomer/lang/en_us.json +++ b/src/main/resources/assets/ok_zoomer/lang/en_us.json @@ -26,6 +26,8 @@ "config.ok_zoomer.features.zoom_mode.persistent.tooltip": "The zoom will always be enabled, with the zoom key being used for zoom scrolling.", "config.ok_zoomer.features.zoom_scrolling": "Zoom Scrolling", "config.ok_zoomer.features.zoom_scrolling.tooltip": "Allows to increase or decrease the zoom by scrolling with the mouse wheel.", + "config.ok_zoomer.features.persistent_interface": "Persistent Interface", + "config.ok_zoomer.features.persistent_interface.tooltip": "Retains the interface when zooming.", "config.ok_zoomer.features.extra_key_binds": "Extra Key Binds", "config.ok_zoomer.features.extra_key_binds.tooltip": "Adds zoom manipulation keys along with the zoom key. A game restart will be required in order to apply the changes.", "config.ok_zoomer.features.zoom_overlay": "Zoom Overlay", @@ -67,6 +69,8 @@ "config.ok_zoomer.tweaks": "Tweaks", "config.ok_zoomer.tweaks.unbind_conflicting_key": "Unbind Conflicting Key", "config.ok_zoomer.tweaks.unbind_conflicting_key.tooltip": "If pressed, the \"Save Toolbar Activator\" keybind will be unbound if there's a conflict with the zoom key.", + "config.ok_zoomer.tweaks.hide_crosshair": "Hide Crosshair", + "config.ok_zoomer.tweaks.hide_crosshair.tooltip": "Hides the crosshair while zooming.", "config.ok_zoomer.tweaks.reset_zoom_with_mouse": "Reset Zoom with Mouse", "config.ok_zoomer.tweaks.reset_zoom_with_mouse.tooltip": "Allows for resetting the zoom with the middle mouse button.", "config.ok_zoomer.tweaks.forget_zoom_divisor": "Forget Zoom Divisor", diff --git a/src/main/resources/assets/ok_zoomer/lang/pt_br.json b/src/main/resources/assets/ok_zoomer/lang/pt_br.json index e40bd1d..49ee2b7 100644 --- a/src/main/resources/assets/ok_zoomer/lang/pt_br.json +++ b/src/main/resources/assets/ok_zoomer/lang/pt_br.json @@ -1,5 +1,5 @@ { - "modmenu.descriptionTranslation.ok_zoomer": "Adiciona uma tecla de zoom bastante configurável. Por padrão, o mod fornece sua própria versão de um zoom, porém, através do menu de configurações e de suas predefinições, você pode drasticamente alterar o zoom para que seja mais familiar, confortável ou útil. O zoom é seu!", + "modmenu.descriptionTranslation.ok_zoomer": "Adiciona uma tecla de zoom com alta configurabilidade. Por padrão, o mod fornece sua própria versão de um zoom, porém, através do menu de configurações e de suas predefinições, você pode drasticamente alterar o zoom para que seja mais familiar, confortável ou útil. O zoom é seu!", "config.ok_zoomer.title": "Definições do Ok Zoomer", "config.ok_zoomer.features": "Funções", "config.ok_zoomer.features.cinematic_camera": "Câmera cinemática", @@ -27,6 +27,8 @@ "config.ok_zoomer.features.zoom_mode.persistent.tooltip": "O zoom sempre será ligado, com a tecla do zoom sendo usado para a rolagem do zoom.", "config.ok_zoomer.features.zoom_scrolling": "Rolagem de zoom", "config.ok_zoomer.features.zoom_scrolling.tooltip": "Permite aumentar ou diminuir o zoom com a rolagem do mouse.", + "config.ok_zoomer.features.persistent_interface": "Interface persistente", + "config.ok_zoomer.features.persistent_interface.tooltip": "Retém a interface durante o zoom.", "config.ok_zoomer.features.extra_key_binds": "Atalhos extra", "config.ok_zoomer.features.extra_key_binds.tooltip": "Adiciona atalhos de manipulação do zoom junto com o atalho do zoom. Uma reinicialização do jogo será necessária para aplicar as mudanças.", "config.ok_zoomer.features.zoom_overlay": "Sobreposição de zoom", @@ -68,6 +70,8 @@ "config.ok_zoomer.tweaks": "Ajustes", "config.ok_zoomer.tweaks.unbind_conflicting_key": "Corrigir atalho conflitante", "config.ok_zoomer.tweaks.unbind_conflicting_key.tooltip": "Se pressionado, o atalho \"Salvar barra rápida\" será anulada caso tenha conflito com o atalho de zoom.", + "config.ok_zoomer.tweaks.hide_crosshair": "Hide Crosshair", + "config.ok_zoomer.tweaks.hide_crosshair.tooltip": "Hides the crosshair while zooming.", "config.ok_zoomer.tweaks.reset_zoom_with_mouse": "Reiniciar zoom com mouse", "config.ok_zoomer.tweaks.reset_zoom_with_mouse.tooltip": "Permite reiniciar o zoom com o botão do meio do mouse.", "config.ok_zoomer.tweaks.forget_zoom_divisor": "Esquecer divisor de zoom", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index baa156a..3e82f92 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -22,7 +22,7 @@ }, "mixins": ["ok_zoomer.mixins.json"], "depends": { - "fabricloader": ">=0.15.10", + "fabricloader": ">=0.16.2", "minecraft": "~1.21", "fabric-api": ">=0.102.0" }, diff --git a/src/main/resources/ok_zoomer.mixins.json b/src/main/resources/ok_zoomer.mixins.json index 4a4c7b2..0655c92 100644 --- a/src/main/resources/ok_zoomer.mixins.json +++ b/src/main/resources/ok_zoomer.mixins.json @@ -1,14 +1,18 @@ { "required": true, + "minVersion": "0.8", "package": "io.github.ennuil.ok_zoomer.mixin", + "plugin": "io.github.ennuil.ok_zoomer.OkZoomerMixinPlugin", "compatibilityLevel": "JAVA_21", "client": [ - "AbstractClientPlayerMixin", - "EditBoxAccessor", - "EditBoxMixin", - "GameRendererMixin", - "GuiMixin", - "MouseHandlerMixin" + "common.AbstractClientPlayerMixin", + "common.EditBoxAccessor", + "common.EditBoxMixin", + "common.GameRendererMixin", + "common.GuiMixin", + "common.MouseHandlerMixin", + "fabric.MouseHandlerMixin", + "sintyra.MouseHandlerMixin" ], "injectors": { "defaultRequire": 1