diff --git a/build.gradle b/build.gradle index 2d6b944..4a50cc4 100644 --- a/build.gradle +++ b/build.gradle @@ -84,8 +84,8 @@ dependencies { modCompileOnly libs.wrench.wrapper - modCompileOnly libs.bundles.trinkets - modLocalRuntime libs.bundles.trinkets + //modCompileOnly libs.bundles.trinkets + //modLocalRuntime libs.bundles.trinkets include libs.wrench.wrapper } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f653b65..0f1f8b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,14 +1,14 @@ # The latest versions are available at https://quiltmc.org/en/usage/latest-versions/ [versions] -minecraft = "1.21.1" +minecraft = "1.21.2-rc1" parchment = "2024.07.28" quilt_loom = "1.8.3" quilt_loader = "0.27.0-beta.1" -fabric_api = "0.106.0+1.21.1" +fabric_api = "0.106.0+1.21.2" wrench_wrapper = "0.5.0" -modmenu = "11.0.3" +modmenu = "12.0.0-beta.1" trinkets = "3.10.0" cca = "6.1.1" diff --git a/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerClientMod.java b/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerClientMod.java index 2b15917..f0df73b 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerClientMod.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerClientMod.java @@ -1,6 +1,5 @@ package io.github.ennuil.ok_zoomer; -import io.github.ennuil.ok_zoomer.compat.TrinketsCompat; import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; import io.github.ennuil.ok_zoomer.events.*; import io.github.ennuil.ok_zoomer.key_binds.ZoomKeyBinds; @@ -9,7 +8,6 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.fabricmc.loader.api.FabricLoader; // This class is responsible for registering the commands and packets public class OkZoomerClientMod implements ClientModInitializer { @@ -33,9 +31,11 @@ public void onInitializeClient() { ClientTickEvents.END_CLIENT_TICK.register(OpenScreenEvent::endClientTick); ClientCommandRegistrationCallback.EVENT.register(RegisterCommands::registerCommands); + /* // mod compat if (FabricLoader.getInstance().isModLoaded("trinkets")) { TrinketsCompat.init(); } + */ } } diff --git a/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerMixinPlugin.java b/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerMixinPlugin.java deleted file mode 100644 index deb2a25..0000000 --- a/src/main/java/io/github/ennuil/ok_zoomer/OkZoomerMixinPlugin.java +++ /dev/null @@ -1,61 +0,0 @@ -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("sinytra") && connectorLoaded) { - LOGGER.warn("Loaded Sinytra-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/compat/TrinketsCompat.java b/src/main/java/io/github/ennuil/ok_zoomer/compat/TrinketsCompat.java deleted file mode 100644 index b851901..0000000 --- a/src/main/java/io/github/ennuil/ok_zoomer/compat/TrinketsCompat.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.github.ennuil.ok_zoomer.compat; - -import dev.emi.trinkets.api.TrinketsApi; -import io.github.ennuil.ok_zoomer.utils.ZoomUtils; - -public class TrinketsCompat { - public static void init() { - ZoomUtils.addSpyglassProvider(player -> { - // Trinkets inventory is an AutoSyncedComponent and therefore safe to query on the client - return player.getComponent(TrinketsApi.TRINKET_COMPONENT).isEquipped(ZoomUtils.IS_VALID_SPYGLASS); - }); - } -} diff --git a/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/OkZoomerAbstractSelectionList.java b/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/OkZoomerAbstractSelectionList.java index cd2d5d8..a034db9 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/OkZoomerAbstractSelectionList.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/config/screen/components/OkZoomerAbstractSelectionList.java @@ -1,6 +1,5 @@ package io.github.ennuil.ok_zoomer.config.screen.components; -import com.mojang.blaze3d.systems.RenderSystem; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import net.minecraft.client.Minecraft; @@ -18,6 +17,7 @@ import net.minecraft.client.gui.navigation.ScreenAxis; import net.minecraft.client.gui.navigation.ScreenDirection; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -135,19 +135,15 @@ protected void narrateListElementPosition(NarrationElementOutput narrationElemen } private void renderListBackground(GuiGraphics graphics) { - RenderSystem.enableBlend(); var backgroundLocation = this.minecraft.level == null ? MENU_LIST_BACKGROUND : INWORLD_MENU_LIST_BACKGROUND; - graphics.blit(backgroundLocation, this.getX(), this.getY(), this.getRight(), this.getBottom() + this.getScrollAmount(), this.width, this.height, 32,32); - RenderSystem.disableBlend(); + graphics.blit(RenderType::guiTextured, backgroundLocation, this.getX(), this.getY(), this.getRight(), this.getBottom() + this.getScrollAmount(), this.width, this.height, 32,32); } private void renderListSeparators(GuiGraphics graphics) { - RenderSystem.enableBlend(); var headerSeparatorLocation = this.minecraft.level == null ? Screen.HEADER_SEPARATOR : Screen.INWORLD_HEADER_SEPARATOR; var footerSeparatorLocation = this.minecraft.level == null ? Screen.FOOTER_SEPARATOR : Screen.INWORLD_FOOTER_SEPARATOR; - graphics.blit(headerSeparatorLocation, this.getX(), this.getY() - 2, 0.0F, 0.0F, this.width, 2, 32, 2); - graphics.blit(footerSeparatorLocation, this.getX(), this.getBottom(), 0.0F, 0.0F, this.width, 2, 32, 2); - RenderSystem.disableBlend(); + graphics.blit(RenderType::guiTextured, headerSeparatorLocation, this.getX(), this.getY() - 2, 0.0F, 0.0F, this.width, 2, 32, 2); + graphics.blit(RenderType::guiTextured, footerSeparatorLocation, this.getX(), this.getBottom(), 0.0F, 0.0F, this.width, 2, 32, 2); } private void renderScrollBar(GuiGraphics graphics) { @@ -157,10 +153,8 @@ private void renderScrollBar(GuiGraphics graphics) { var scale = (this.scrollAmount / (double) (this.contentHeight - this.height)); var y = this.getY() + (int) (scale * (this.height - size)); - RenderSystem.enableBlend(); - graphics.blitSprite(SCROLLER_BACKGROUND_SPRITE, x, this.getY(), 6, this.height); - graphics.blitSprite(SCROLLER_SPRITE, x, y, 6, size); - RenderSystem.disableBlend(); + graphics.blitSprite(RenderType::guiTextured, SCROLLER_BACKGROUND_SPRITE, x, this.getY(), 6, this.height); + graphics.blitSprite(RenderType::guiTextured, SCROLLER_SPRITE, x, y, 6, size); } protected int getScrollBarPosX() { diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GameRendererMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GameRendererMixin.java index cc4517a..3c5a1a6 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GameRendererMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/GameRendererMixin.java @@ -2,7 +2,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.sugar.Local; -import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef; +import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager; import io.github.ennuil.ok_zoomer.zoom.Zoom; import net.minecraft.client.Camera; @@ -57,12 +57,11 @@ private int modifyCulling(int original) { ordinal = 0 ) ) - private void getZoomedFov(Camera activeRenderInfo, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir, @Local LocalDoubleRef internalFov) { - double zoomedFov = internalFov.get(); + private void getZoomedFov(Camera activeRenderInfo, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir, @Local(ordinal = 1) LocalFloatRef internalFov) { + float zoomedFov = internalFov.get(); if (Zoom.isTransitionActive()) { - // This looks bad now, but don't worry, it *will* make sense on Minecraft 1.21.2 - zoomedFov = Zoom.getTransitionMode().applyZoom((float) zoomedFov, partialTicks); + zoomedFov = Zoom.getTransitionMode().applyZoom(zoomedFov, partialTicks); } internalFov.set(zoomedFov); 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 index e205bd8..d1c33f1 100644 --- 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 @@ -7,7 +7,6 @@ import com.llamalad7.mixinextras.sugar.Local; 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; @@ -16,7 +15,6 @@ import net.minecraft.client.gui.components.DebugScreenOverlay; import org.joml.Vector3f; import org.quiltmc.loader.api.minecraft.ClientOnly; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -92,46 +90,30 @@ private void zoomGui(GuiGraphics graphics, DeltaTracker deltaTracker, Operation< private void hideCrosshair(GuiGraphics graphics, DeltaTracker deltaTracker, Operation original) { boolean persistentInterface = OkZoomerConfigManager.CONFIG.features.persistentInterface.value(); boolean hideCrosshair = OkZoomerConfigManager.CONFIG.tweaks.hideCrosshair.value(); - if ((persistentInterface && !hideCrosshair) || !Zoom.isTransitionActive()) { + if (persistentInterface || hideCrosshair || !Zoom.isTransitionActive()) { original.call(graphics, deltaTracker); } else { - if (hideCrosshair) { - float fade = 1.0F - Zoom.getTransitionMode().getFade(deltaTracker.getGameTimeDeltaPartialTick(true)); - RenderSystem.setShaderColor(fade, fade, fade, fade); - } - if (!persistentInterface && !hideCrosshair) { - // TODO - This has been recycled once, this should become a method - var lastPose = graphics.pose().last().pose(); - graphics.pose().popPose(); - graphics.pose().popPose(); - graphics.pose().pushPose(); - graphics.pose().translate(0.0F, 0.0F, lastPose.getTranslation(new Vector3f()).z); - original.call(graphics, deltaTracker); - graphics.pose().pushPose(); - graphics.pose().translate(-(graphics.guiWidth() / translation), -(graphics.guiHeight() / translation), 0.0F); - graphics.pose().scale(scale, scale, 1.0F); - } else { - original.call(graphics, deltaTracker); - } - if (hideCrosshair) { - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - } + // TODO - This has been recycled once, this should become a method + var lastPose = graphics.pose().last().pose(); + graphics.pose().popPose(); + graphics.pose().popPose(); + graphics.pose().pushPose(); + graphics.pose().translate(0.0F, 0.0F, lastPose.getTranslation(new Vector3f()).z); + original.call(graphics, deltaTracker); + graphics.pose().pushPose(); + graphics.pose().translate(-(graphics.guiWidth() / translation), -(graphics.guiHeight() / translation), 0.0F); + graphics.pose().scale(scale, scale, 1.0F); } } // TODO - This is a very promising method to get individual HUDs persistent, but I'm not sure if it's bulletproof! // It doesn't crash with Sodium nor ImmediatelyFast though, and that's good - @Dynamic @WrapOperation( - method = { - "method_55807", - "lambda$new$6" // Heck yeah! It's Neo-specific hack time! - }, + method = "method_55807", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/gui/components/DebugScreenOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;)V" - ), - allow = 1 + ) ) private void ensureDebugHudVisibility(DebugScreenOverlay instance, GuiGraphics graphics, Operation original, @Local(argsOnly = true) DeltaTracker deltaTracker) { if (OkZoomerConfigManager.CONFIG.features.persistentInterface.value() || !Zoom.getTransitionMode().getActive()) { diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/MouseHandlerMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/MouseHandlerMixin.java index 03d26fe..ebba41f 100644 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/MouseHandlerMixin.java +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/MouseHandlerMixin.java @@ -32,7 +32,7 @@ public abstract class MouseHandlerMixin { at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z"), cancellable = true ) - private void zoomerOnMouseScroll(CallbackInfo ci, @Local(ordinal = 2) int k) { + private void zoomerOnMouseScroll(CallbackInfo ci, @Local int k) { if (k != 0) { if (OkZoomerConfigManager.CONFIG.features.zoomScrolling.value()) { if (OkZoomerConfigManager.CONFIG.features.zoomMode.value().equals(ZoomModes.PERSISTENT)) { diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/RenderStateShardMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/RenderStateShardMixin.java new file mode 100644 index 0000000..19b3fca --- /dev/null +++ b/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/RenderStateShardMixin.java @@ -0,0 +1,31 @@ +package io.github.ennuil.ok_zoomer.mixin.common; + +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.Minecraft; +import net.minecraft.client.renderer.RenderStateShard; +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(RenderStateShard.class) +public abstract class RenderStateShardMixin { + @Inject(method = "method_62269", at = @At("TAIL")) + private static void fadeCrosshair(CallbackInfo ci) { + if (OkZoomerConfigManager.CONFIG.tweaks.hideCrosshair.value()) { + float fade = 1.0F - Zoom.getTransitionMode().getFade(Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(true)); + RenderSystem.setShaderColor(fade, fade, fade, fade); + } + } + + @Inject(method = "method_62268", at = @At("HEAD")) + private static void resetCrosshairFade(CallbackInfo ci) { + if (OkZoomerConfigManager.CONFIG.tweaks.hideCrosshair.value()) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + } + } +} diff --git a/src/main/java/io/github/ennuil/ok_zoomer/mixin/sinytra/MouseHandlerMixin.java b/src/main/java/io/github/ennuil/ok_zoomer/mixin/sinytra/MouseHandlerMixin.java deleted file mode 100644 index 1c0de45..0000000 --- a/src/main/java/io/github/ennuil/ok_zoomer/mixin/sinytra/MouseHandlerMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.github.ennuil.ok_zoomer.mixin.sinytra; - -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;" - ) - ) - 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 0e4cfd4..5f85d6f 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 @@ -51,7 +51,7 @@ public static void validateZoomCulling(Minecraft minecraft) { int zoomCullingFov = Math.ceilDiv(fov, divisor); if (zoomCullingFov != lastZoomCullingFov) { - minecraft.levelRenderer.needsUpdate(); + minecraft.levelRenderer.getSectionOcclusionGraph().invalidate(); } lastZoomCullingFov = zoomCullingFov; @@ -102,7 +102,7 @@ public static void unbindConflictingKey(Minecraft client, boolean userPrompted) if (client.options.keySaveHotbarActivator.isDefault()) { if (userPrompted) { ZoomUtils.LOGGER.info("[Ok Zoomer] The \"Save Toolbar Activator\" keybind was occupying C! Unbinding..."); - client.getToasts().addToast(SystemToast.multiline( + client.getToastManager().addToast(SystemToast.multiline( client, TOAST_ID, Component.translatable("toast.ok_zoomer.title"), Component.translatable("toast.ok_zoomer.unbind_conflicting_key.success"))); } else { @@ -114,7 +114,7 @@ public static void unbindConflictingKey(Minecraft client, boolean userPrompted) } else { ZoomUtils.LOGGER.info("[Ok Zoomer] No conflicts with the \"Save Toolbar Activator\" keybind were found!"); if (userPrompted) { - client.getToasts().addToast(SystemToast.multiline( + client.getToastManager().addToast(SystemToast.multiline( client, TOAST_ID, Component.translatable("toast.ok_zoomer.title"), Component.translatable("toast.ok_zoomer.unbind_conflicting_key.no_conflict"))); } 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 fe4b464..005a0c1 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,5 @@ 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.gui.GuiGraphics; @@ -46,9 +45,7 @@ public void renderOverlay(GuiGraphics graphics, DeltaTracker deltaTracker, Trans int y = (guiHeight - height) / 2; int borderX = x + width; int borderY = y + height; - RenderSystem.enableBlend(); - graphics.blit(textureId, x, y, -90, 0.0F, 0.0F, width, height, width, height); - RenderSystem.disableBlend(); + graphics.blit(RenderType::guiTextured, textureId, x, y, 0.0F, 0.0F, width, height, width, height); graphics.fill(RenderType.guiOverlay(), 0, borderY, guiWidth, guiHeight, -90, CommonColors.BLACK); graphics.fill(RenderType.guiOverlay(), 0, 0, guiWidth, y, -90, CommonColors.BLACK); graphics.fill(RenderType.guiOverlay(), 0, y, x, borderY, -90, CommonColors.BLACK); 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 419daa3..3b58b70 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 @@ -1,15 +1,11 @@ package io.github.ennuil.ok_zoomer.zoom.overlays; -import com.mojang.blaze3d.platform.GlStateManager; -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.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; +import net.minecraft.util.ARGB; // Implements the zoom overlay public class ZoomerZoomOverlay implements ZoomOverlay { @@ -28,18 +24,9 @@ public boolean getActive() { @Override 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 fade = 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(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.defaultBlendFunc(); - RenderSystem.disableBlend(); + int color = ARGB.colorFromFloat(1.0F, fade, fade, fade); + graphics.blit(RenderType::vignette, this.textureId, 0, 0, 0.0F, 0.0F, graphics.guiWidth(), graphics.guiHeight(), graphics.guiWidth(), graphics.guiHeight(), color); } @Override diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c1f4e78..24d7252 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -22,9 +22,9 @@ }, "mixins": ["ok_zoomer.mixins.json"], "depends": { - "fabricloader": ">=0.16.2", - "minecraft": "~1.21", - "fabric-api": ">=0.102.0" + "fabricloader": ">=0.16.7", + "minecraft": ">=1.21.2- <1.22", + "fabric-api": ">=0.106.0" }, "custom": { "mc-publish": { diff --git a/src/main/resources/ok_zoomer.mixins.json b/src/main/resources/ok_zoomer.mixins.json index f747aa1..5dfe074 100644 --- a/src/main/resources/ok_zoomer.mixins.json +++ b/src/main/resources/ok_zoomer.mixins.json @@ -2,7 +2,6 @@ "required": true, "minVersion": "0.8", "package": "io.github.ennuil.ok_zoomer.mixin", - "plugin": "io.github.ennuil.ok_zoomer.OkZoomerMixinPlugin", "compatibilityLevel": "JAVA_21", "client": [ "common.AbstractClientPlayerMixin", @@ -11,8 +10,8 @@ "common.GameRendererMixin", "common.GuiMixin", "common.MouseHandlerMixin", - "fabric.MouseHandlerMixin", - "sinytra.MouseHandlerMixin" + "common.RenderStateShardMixin", + "fabric.MouseHandlerMixin" ], "injectors": { "defaultRequire": 1