From 46bcdafb0f77f44a9d8592516a20acc0278f5bad Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Thu, 9 May 2024 04:38:17 +1000 Subject: Add Hide hearts bouncing due to regen effect (#1154) --- .../notenoughupdates/mixins/MixinGuiIngameForge.java | 11 +++++++++++ .../notenoughupdates/options/separatesections/Misc.java | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java index b263cf31..9ad3e921 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java @@ -19,9 +19,12 @@ package io.github.moulberry.notenoughupdates.mixins; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; import net.minecraftforge.client.GuiIngameForge; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -34,4 +37,12 @@ public class MixinGuiIngameForge { public Item renderHelmet(ItemStack stack) { return ItemCustomizeManager.useCustomItem(stack).getItem(); } + + @Redirect(method = "renderHealth", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/EntityPlayer;isPotionActive(Lnet/minecraft/potion/Potion;)Z", ordinal = 0)) + public boolean renderHealth(EntityPlayer player, Potion potion) { + if (!NotEnoughUpdates.INSTANCE.config.misc.hideRegenBounce || !NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + return player.isPotionActive(potion); + } + return false; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Misc.java index f0e36d56..1f5c84ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Misc.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Misc.java @@ -363,4 +363,12 @@ public class Misc { values = {"Off", "AM/PM [1PM]", "24hr [13:00]"} ) public int showWhenCountdownEnds = 1; + + @Expose + @ConfigOption( + name = "Stop Hearts Bouncing", + desc = "Stops the hearts bouncing with regeneration effect" + ) + @ConfigEditorBoolean + public boolean hideRegenBounce = false; } -- cgit