Class HudManager

java.lang.Object
io.hymods.lib.hud.HudManager

public class HudManager extends Object
Utility class for managing multiple custom HUDs per player. Since Hytale does not natively support showing multiple custom HUDs at once, this manager wraps multiple HUDs into a single MultipleCustomUIHud that renders them all simultaneously. Usage:
// Set a HUD with an identifier
HudManager.setCustomHud(player, playerRef, "mymod:hud", myCustomHud);

// Hide a specific HUD
HudManager.hideCustomHud(player, playerRef, "mymod:hud");
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.hypixel.hytale.server.core.entity.entities.player.hud.CustomUIHud
    getCustomHud(com.hypixel.hytale.server.core.entity.entities.Player player, String hudIdentifier)
    Gets a specific HUD by identifier from the player's current HUD.
    static void
    hideCustomHud(com.hypixel.hytale.server.core.entity.entities.Player player, com.hypixel.hytale.server.core.universe.PlayerRef playerRef, String hudIdentifier)
    Hides (removes) a custom HUD identified by the given identifier.
    static void
    refreshHud(com.hypixel.hytale.server.core.entity.entities.Player player)
    Refreshes the combined HUD display for a player.
    static void
    setCustomHud(com.hypixel.hytale.server.core.entity.entities.Player player, com.hypixel.hytale.server.core.universe.PlayerRef playerRef, String hudIdentifier, com.hypixel.hytale.server.core.entity.entities.player.hud.CustomUIHud customHud)
    Sets or updates a custom HUD for a player with the given identifier.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HudManager

      public HudManager()
  • Method Details

    • setCustomHud

      public static void setCustomHud(@Nonnull com.hypixel.hytale.server.core.entity.entities.Player player, @Nonnull com.hypixel.hytale.server.core.universe.PlayerRef playerRef, @Nonnull String hudIdentifier, @Nonnull com.hypixel.hytale.server.core.entity.entities.player.hud.CustomUIHud customHud)
      Sets or updates a custom HUD for a player with the given identifier. If the player already has a MultipleCustomUIHud, the new HUD is added to it. If the player has a different CustomUIHud, it's preserved as "Unknown". If the player has no HUD, a new MultipleCustomUIHud is created.
      Parameters:
      player - The player to set the HUD for
      playerRef - The player reference
      hudIdentifier - A unique identifier for this HUD (e.g., "minimap", "whatisthat")
      customHud - The custom HUD to add or update
    • hideCustomHud

      public static void hideCustomHud(@Nonnull com.hypixel.hytale.server.core.entity.entities.Player player, @Nonnull com.hypixel.hytale.server.core.universe.PlayerRef playerRef, @Nonnull String hudIdentifier)
      Hides (removes) a custom HUD identified by the given identifier.
      Parameters:
      player - The player to hide the HUD for
      playerRef - The player reference
      hudIdentifier - The identifier of the HUD to hide
    • getCustomHud

      public static com.hypixel.hytale.server.core.entity.entities.player.hud.CustomUIHud getCustomHud(@Nonnull com.hypixel.hytale.server.core.entity.entities.Player player, @Nonnull String hudIdentifier)
      Gets a specific HUD by identifier from the player's current HUD.
      Parameters:
      player - The player to get the HUD from
      hudIdentifier - The identifier of the HUD to retrieve
      Returns:
      The HUD if found, null otherwise
    • refreshHud

      public static void refreshHud(@Nonnull com.hypixel.hytale.server.core.entity.entities.Player player)
      Refreshes the combined HUD display for a player. Call this instead of calling show() directly on individual HUDs when using the multiple HUD system. This ensures all HUDs are rendered together.
      Parameters:
      player - The player whose HUD should be refreshed