Class HardcoreState

java.lang.Object
com.hypixel.hytale.server.core.universe.hardcore.HardcoreState

public class HardcoreState extends Object
The persistent hardcore run state of the universe: the shared pool of lives for the HardcoreMode.Global and the game-over flag.

Held as a universe resource, so one instance is shared across world threads. The pool seeds lazily from the configured size on the first burned life. An unseeded pool persists as the Integer.MIN_VALUE sentinel, so a universe that never lost a life follows a later config change to the pool size.

  • Field Details

  • Constructor Details

    • HardcoreState

      public HardcoreState()
  • Method Details

    • getResourceType

      @Nonnull public static UniverseResourceType<HardcoreState> getResourceType()
      Returns:
      the registered UniverseResourceType of this resource.
    • burnPoolLife

      public int burnPoolLife(int poolSize)
      Burns one life from the shared pool. The first burn seeds the pool from the given size.
      Parameters:
      poolSize - The configured pool size.
      Returns:
      the lives left after the burn. Exactly one burn returns 0.
    • getPoolRemaining

      public int getPoolRemaining(int poolSize)
      Parameters:
      poolSize - The configured pool size.
      Returns:
      the lives left in the shared pool, the full size when no life burned yet.
    • isGameOver

      public boolean isGameOver()
      Returns:
      whether the run has ended for the whole universe.
    • markGameOver

      public boolean markGameOver()
      Marks the run as ended.
      Returns:
      true only for the call that makes the transition.