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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
//~ gui_graphics
package org.polyfrost.oneconfig.internal;

import java.util.function.BooleanSupplier;
import com.mojang.brigadier.Command;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
Expand Down Expand Up @@ -193,6 +194,8 @@ private static boolean isHudEditor(Object screen) {
}

private static boolean isTabListVisible() {
BooleanSupplier override = HudManager.tabListVisibility;
if (override != null) return override.getAsBoolean();
Minecraft minecraft = Minecraft.getInstance();
if (!minecraft.options.keyPlayerList.isDown()) return false;
if (minecraft.level == null || minecraft.player == null) return false;
Expand Down Expand Up @@ -347,6 +350,8 @@ private static void registerEventHandlers() {
EventManager.register(WorldEvent.Load.class, e -> {
showFirstLaunchNotification();
});
// leaving a world or server ends any temporary visibility flip
EventManager.register(WorldEvent.Unload.class, e -> HudManager.resetVisibilityKeys());
// after loading finishes so translation keys are available
EventManager.register(ResourceFinishedLoading.class, e -> SearchCorpus.INSTANCE.init());
EventManager.register(ResourceFinishedLoading.class, e -> CompatLoader.INSTANCE.onResourcesLoaded());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ object LegacyHudRenderer {
for (hud in HudManager.activeInstances) {
if (hud !is LegacyHud) continue
if (!HudManager.isEditing) {
if (hud.hidden) continue
if (hud.effectivelyHidden && !hud.drawsWhileHidden()) continue
if (HudManager.isGuiHidden) continue
if (HudManager.allHudsHiddenByKey) continue
if (HudManager.isDebugScreenVisible && !hud.showInF3) continue
if (HudManager.isTabListVisible && !hud.showInTab) continue
if (!HudManager.overrideShowInScreens) {
Expand Down
11 changes: 11 additions & 0 deletions minecraft/src/main/resources/assets/oneconfig/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@
"oneconfig.preferences.hud_marquee_anim_duration.title": "Selection Box Animation Duration (ms)",
"oneconfig.preferences.hud_marquee_anim_duration.description": "The duration of the fade animation for the drag selection rectangle in milliseconds.",

"oneconfig.preferences.category.huds": "HUDs",
"oneconfig.preferences.hud_toggle_all_keybind.title": "Hide All HUDs",
"oneconfig.preferences.hud_toggle_all_keybind.description": "Temporarily hides every HUD. Each HUD can also have its own key in its Visibility settings.",
"oneconfig.preferences.hud_toggle_all_mode.title": "Hide All HUDs Mode",
"oneconfig.preferences.hud_toggle_all_mode.description": "Held hides HUDs only while the key is held. Toggle switches them on each press. Quick Press switches on a tap and switches back when a longer hold is released.",
"oneconfig.preferences.hud_toggle_all_hold_threshold.title": "Hold Threshold (ms)",
"oneconfig.preferences.hud_toggle_all_hold_threshold.description": "How long the key must be held in Quick Press mode before releasing it switches back.",
"oneconfig.preferences.key_mode.held": "Held",
"oneconfig.preferences.key_mode.toggle": "Toggle",
"oneconfig.preferences.key_mode.quick_press": "Quick Press",

"oneconfig.preferences.background_blur.title": "Background Blur",
"oneconfig.preferences.background_blur.description": "Blurs the full game background when the OneConfig menu is open.",
"oneconfig.preferences.reduced_motion.title": "Reduced Motion",
Expand Down
27 changes: 23 additions & 4 deletions modules/hud/api/hud.api
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
protected final fun contentChanged ()V
public fun defaultPosition ()Lkotlin/Pair;
public fun deletable ()Z
public fun drawsWhileHidden ()Z
public final fun getAlignment ()Lorg/polyfrost/compose/layout/PolyAlign;
public fun getAlwaysRedraw ()Z
public final fun getAnchorOffsetX ()F
Expand Down Expand Up @@ -78,12 +79,14 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
public final fun getEffectiveGrowthAnchor ()Lorg/polyfrost/oneconfig/api/hud/v1/HudAnchor;
public final fun getEffectiveScale ()F
public final fun getEffectiveSelfAnchorPoint ()Lorg/polyfrost/oneconfig/api/hud/v1/HudAnchor;
public final fun getEffectivelyHidden ()Z
public fun getExternalPlacement ()Lorg/polyfrost/oneconfig/api/hud/v1/ExternalPlacement;
public final fun getFont ()Lorg/polyfrost/oneconfig/api/hud/v1/Font;
public final fun getFullShadow ()Z
public final fun getGrowthAnchor ()Lorg/polyfrost/oneconfig/api/hud/v1/HudAnchor;
public final fun getHasBeenMoved ()Z
public fun getHidden ()Z
public fun getHudEnabled ()Z
public final fun getKeepBgWhenHidden ()Z
public fun getLocked ()Z
public final fun getMergeAcrossColours ()Z
Expand Down Expand Up @@ -122,7 +125,7 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
public final fun getShowInF3 ()Z
public final fun getShowInScreens ()Z
public final fun getShowInTab ()Z
public final fun getShowKey ()I
public final synthetic fun getShowKey ()I
public final fun getShowShadow ()Z
public fun getStaticH ()F
public fun getStaticW ()F
Expand All @@ -137,13 +140,19 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
public final fun getTextScale ()F
public final fun getTextUnderline ()Z
public final fun getTextWeight ()Lorg/polyfrost/oneconfig/api/hud/v1/Weight;
public final fun getToggleKey ()I
public final synthetic fun getToggleKey ()I
public final fun getToggleKeybind ()Lorg/polyfrost/oneconfig/api/ui/v1/keybind/OneConfigKeybind;
public final fun getUseGuiScale ()Z
public final fun getVisibilityKeyActive ()Z
public final fun getVisibilityKeyHoldThreshold ()I
public final fun getVisibilityKeyMode ()Lorg/polyfrost/oneconfig/api/ui/v1/keybind/KeyPressMode;
public final fun getVisibilityKeybind ()Lorg/polyfrost/oneconfig/api/ui/v1/keybind/OneConfigKeybind;
public fun getX ()F
public fun getY ()F
public fun hasBackground ()Z
public fun hasBorder ()Z
public fun hasVisibilityKeyMode ()Z
public fun hasVisibilityKeybind ()Z
public final fun hudBackground ()Lorg/polyfrost/compose/composables/PolyModifier;
public final fun hudBackground (Lorg/polyfrost/compose/composables/PolyModifier;)Lorg/polyfrost/compose/composables/PolyModifier;
public static synthetic fun hudBackground$default (Lorg/polyfrost/oneconfig/api/hud/v1/Hud;Lorg/polyfrost/compose/composables/PolyModifier;ILjava/lang/Object;)Lorg/polyfrost/compose/composables/PolyModifier;
Expand All @@ -163,6 +172,7 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
public final fun reseedStaticHeight ()V
public final fun reseedStaticSizeIfNeeded ()V
public final fun reseedStaticWidth ()V
public fun resetVisibilityKey ()V
public final fun setAbsolutePosition (FF)V
public final fun setAlignment (Lorg/polyfrost/compose/layout/PolyAlign;)V
public final fun setAnchorOffsetX (F)V
Expand All @@ -188,6 +198,7 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
public final fun setGrowthAnchor (Lorg/polyfrost/oneconfig/api/hud/v1/HudAnchor;)V
public final fun setGrowthAnchorKeepingPosition (Lorg/polyfrost/oneconfig/api/hud/v1/HudAnchor;)V
public fun setHidden (Z)V
public fun setHudEnabled (Z)V
public final fun setKeepBgWhenHidden (Z)V
public final fun setLayoutRefH (F)V
public final fun setLayoutRefW (F)V
Expand Down Expand Up @@ -217,7 +228,7 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
public final fun setShowInF3 (Z)V
public final fun setShowInScreens (Z)V
public final fun setShowInTab (Z)V
public final fun setShowKey (I)V
public final synthetic fun setShowKey (I)V
public final fun setShowShadow (Z)V
public fun setStaticH (F)V
public fun setStaticW (F)V
Expand All @@ -232,9 +243,12 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
public final fun setTextScale (F)V
public final fun setTextUnderline (Z)V
public final fun setTextWeight (Lorg/polyfrost/oneconfig/api/hud/v1/Weight;)V
public final fun setToggleKey (I)V
public final synthetic fun setToggleKey (I)V
public final fun setToggleKeybind (Lorg/polyfrost/oneconfig/api/ui/v1/keybind/OneConfigKeybind;)V
public final fun setUseGuiScale (Z)V
public final fun setVisibilityKeyHoldThreshold (I)V
public final fun setVisibilityKeyMode (Lorg/polyfrost/oneconfig/api/ui/v1/keybind/KeyPressMode;)V
public final fun setVisibilityKeybind (Lorg/polyfrost/oneconfig/api/ui/v1/keybind/OneConfigKeybind;)V
public fun setX (F)V
public fun setY (F)V
public fun setup ()V
Expand All @@ -246,6 +260,7 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one
protected fun updateRelativeX (F)V
protected fun updateRelativeY (F)V
protected final fun updateWhenChanged (Ljava/lang/String;)V
public final fun visibilityKeyInput (Z)V
public final fun withSystemPosition (Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public fun xForWidth (F)F
public fun yForHeight (F)F
Expand Down Expand Up @@ -341,7 +356,9 @@ public final class org/polyfrost/oneconfig/api/hud/v1/HudManager {
public static field layoutRefWidth F
public static field overrideShowInScreens Z
public static field partialTick F
public static field tabListVisibility Ljava/util/function/BooleanSupplier;
public final fun getActiveInstances ()Ljava/util/ArrayList;
public static final fun getAllHudsHiddenByKey ()Z
public final fun getHudsOfType (Ljava/lang/Class;)Ljava/util/ArrayList;
public static final fun getLayoutReferenceHeight ()F
public static final fun getLayoutReferenceWidth ()F
Expand Down Expand Up @@ -369,6 +386,8 @@ public final class org/polyfrost/oneconfig/api/hud/v1/HudManager {
public static synthetic fun registerLater$default (Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V
public final fun removeHud (Lorg/polyfrost/oneconfig/api/hud/v1/Hud;Z)V
public static synthetic fun removeHud$default (Lorg/polyfrost/oneconfig/api/hud/v1/HudManager;Lorg/polyfrost/oneconfig/api/hud/v1/Hud;ZILjava/lang/Object;)V
public static final fun resetAllHudsKey ()V
public static final fun resetVisibilityKeys ()V
public static final fun suppressionReasons (Lorg/polyfrost/oneconfig/api/hud/v1/Hud;)Ljava/util/List;
public final fun toggleAllHuds (Lorg/polyfrost/oneconfig/api/hud/v1/Hud;Z)V
public final fun unregister (Lorg/polyfrost/oneconfig/api/hud/v1/Hud;ZZ)Ljava/util/ArrayList;
Expand Down
Loading