diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-22 16:29:18 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-22 16:29:18 +0100 |
commit | 13994393ed392b33161cd427cc9730c9f1b11e35 (patch) | |
tree | b7c586e22fa2e559d867ab811e26f2933b32c3e1 /src/main/java | |
parent | 856f5e0e815c8ef3be77ef342e1b0ca91aab8b0a (diff) | |
download | Firmament-13994393ed392b33161cd427cc9730c9f1b11e35.tar.gz Firmament-13994393ed392b33161cd427cc9730c9f1b11e35.tar.bz2 Firmament-13994393ed392b33161cd427cc9730c9f1b11e35.zip |
feat: Hide potion effects
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java b/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java new file mode 100644 index 0000000..c5af8b6 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java @@ -0,0 +1,29 @@ +package moe.nea.firmament.mixins; + +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; +import moe.nea.firmament.features.fixes.Fixes; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; +import net.minecraft.client.gui.screen.ingame.StatusEffectsDisplay; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(InventoryScreen.class) +public abstract class HideStatusEffectsPatch { + @Shadow + public abstract boolean shouldHideStatusEffectHud(); + + @Inject(method = "shouldHideStatusEffectHud", at = @At("HEAD"), cancellable = true) + private void hideStatusEffects(CallbackInfoReturnable<Boolean> cir) { + cir.setReturnValue(!Fixes.TConfig.INSTANCE.getHidePotionEffects()); + } + + @WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/StatusEffectsDisplay;drawStatusEffects(Lnet/minecraft/client/gui/DrawContext;IIF)V")) + private boolean conditionalRenderStatuses(StatusEffectsDisplay instance, DrawContext context, int mouseX, int mouseY, float tickDelta) { + return shouldHideStatusEffectHud() || !Fixes.TConfig.INSTANCE.getHidePotionEffects(); + } + +} |