From b47a1f596e85358a834f0dc105010be79cd5b2c2 Mon Sep 17 00:00:00 2001 From: inglettronald Date: Fri, 30 Jun 2023 23:53:15 -0500 Subject: Option added to hide Status Effects --- .../mixin/render/AbstractInventoryScreenMixin.java | 20 ++++++++++++++++++++ .../dulkirfabric/mixin/render/InGameHudMixin.java | 20 ++++++++++++++++++++ .../kotlin/com/dulkirfabric/config/DulkirConfig.kt | 6 +++++- src/main/resources/dulkirmod-fabric.mixins.json | 2 ++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java create mode 100644 src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java (limited to 'src/main') diff --git a/src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java new file mode 100644 index 0000000..fd32af7 --- /dev/null +++ b/src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java @@ -0,0 +1,20 @@ +package com.dulkirfabric.mixin.render; + +import com.dulkirfabric.config.DulkirConfig; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen; +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(AbstractInventoryScreen.class) +public class AbstractInventoryScreenMixin { + + @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true) + public void onDrawStatusEffects(DrawContext context, int mouseX, int mouseY, CallbackInfo ci) { + if (DulkirConfig.ConfigVars.getConfigOptions().getStatusEffectHidden()) { + ci.cancel(); + } + } +} diff --git a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java new file mode 100644 index 0000000..cd45aed --- /dev/null +++ b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java @@ -0,0 +1,20 @@ +package com.dulkirfabric.mixin.render; + +import com.dulkirfabric.config.DulkirConfig; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.hud.InGameHud; +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(InGameHud.class) +public class InGameHudMixin { + + @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true) + public void onRenderStatusEffectOverlay(DrawContext context, CallbackInfo ci) { + if (DulkirConfig.ConfigVars.getConfigOptions().getStatusEffectHidden()) { + ci.cancel(); + } + } +} diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt index 4fb42a8..408d180 100644 --- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt +++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt @@ -76,6 +76,9 @@ class DulkirConfig { general.addEntry( entryBuilder.mkToggle(Text.literal("Ignore Reverse Third Person"), configOptions::ignoreReverseThirdPerson) ) + general.addEntry( + entryBuilder.mkToggle(Text.literal("Disable Status Effect Rendering"), configOptions::statusEffectHidden) + ) general.addEntry( entryBuilder.mkToggle(Text.literal("Custom Block outlines"), configOptions::customBlockOutlines) ) @@ -148,7 +151,8 @@ class DulkirConfig { var blockOutlineColor: Int = 0xFFFFFF, var abiPhoneDND: Boolean = false, var abiPhoneCallerID: Boolean = false, - var tooltipScale: Float = 1f + var tooltipScale: Float = 1f, + var statusEffectHidden: Boolean = false ) @Serializable diff --git a/src/main/resources/dulkirmod-fabric.mixins.json b/src/main/resources/dulkirmod-fabric.mixins.json index 330c9ac..32f8b98 100644 --- a/src/main/resources/dulkirmod-fabric.mixins.json +++ b/src/main/resources/dulkirmod-fabric.mixins.json @@ -9,9 +9,11 @@ "MouseMixin", "SoundSystemMixin", "io.HandledScreenMixin", + "render.AbstractInventoryScreenMixin", "render.DrawContextMixin", "render.GameMenuScreenMixin", "render.GameRendererMixin", + "render.InGameHudMixin", "render.KeyboardMixin", "render.LoomScreenMixin", "render.MinecraftClientMixin", -- cgit