Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/java/de/hysky/skyblocker/mixins/HudMixin.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package de.hysky.skyblocker.mixins;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.hunting.safari.SafariUtils;
import de.hysky.skyblocker.skyblock.fancybars.VanillaStyleManaBar;
import de.hysky.skyblocker.skyblock.item.HotbarSlotLock;
import de.hysky.skyblocker.skyblock.item.ItemCooldowns;
import de.hysky.skyblocker.skyblock.item.ItemProtection;
Expand Down Expand Up @@ -131,4 +133,10 @@ private static boolean isQuiverItem(ItemStack stack) {
private int skyblocker$hideSafariColdOverlay(int original) {
return Utils.isOnSkyblock() && SafariUtils.isInIcyBiome() && SkyblockerConfigManager.get().hunting.icyBiome.hideColdOverlay ? 0 : original;
}

// Workaround, can be removed when https://github.com/FabricMC/fabric-api/issues/5517 is fixed. See VanillaStylemanaBar.java for proper fix
@ModifyReturnValue(method = "getAirBubbleYLine", at = @At("RETURN"))
private int skyblocker$adjustAirBubbleHeight(int original) {
return VanillaStyleManaBar.isEnabled() ? original - 10 : original;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m a bit confused, shouldn’t this be +10 when enabled?

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,23 @@ public static void init() {
HudElementRegistry.attachElementBefore(VanillaHudElements.MOUNT_HEALTH, MANABAR_MOUNT_HUD_ID, (context, _) -> {
if (isEnabled()) extractRenderState(context);
});

/*
Proper implementation of height for bars, broken due to https://github.com/FabricMC/fabric-api/issues/5517
When fixed uncomment this and remove corresponding mixin from HudMixn.java

// 10 pixels is the spacing for a single bar, the mana bar always has 2 bars so has a height of 20 pixels
HudStatusBarHeightRegistry.addRight(VanillaHudElements.FOOD_BAR, (player) -> isEnabled() ? 0 : 10);
HudStatusBarHeightRegistry.addRight(VanillaHudElements.MOUNT_HEALTH, (player) -> isEnabled() ? 0 : 10);
// Only height for one bar needs to be registered, since the height for both bars is always enabled even when not visible.
// This could be changed if we had a condition like "isEnabled() && isHungerBarVisible()" for each individual bar,
// but as far as I am aware that condition is not easily available
HudStatusBarHeightRegistry.addRight(MANABAR_MOUNT_HUD_ID, (player) -> isEnabled() ? 20 : 0);
*/
}

private static boolean isEnabled() {
return Utils.isOnSkyblock() && SkyblockerConfigManager.get().uiAndVisuals.bars.enableVanillaStyleManaBar && !FancyStatusBars.isEnabled();
public static boolean isEnabled() {
return Utils.isOnSkyblock() && SkyblockerConfigManager.get().uiAndVisuals.bars.enableVanillaStyleManaBar && !FancyStatusBars.isEnabled();
}

private static void extractNotch(GuiGraphicsExtractor graphics, int column, int row, NotchType notchtype, boolean isHalf, boolean isBlinking) {
Expand Down