Contents
Class HardcoreState
java.lang.Object
com.hypixel.hytale.server.core.universe.hardcore.HardcoreState
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintburnPoolLife(int poolSize) Burns one life from the shared pool.intgetPoolRemaining(int poolSize) static UniverseResourceType<HardcoreState> booleanbooleanMarks the run as ended.
-
Field Details
-
CODEC
-
-
Constructor Details
-
HardcoreState
public HardcoreState()
-
-
Method Details
-
getResourceType
- Returns:
- the registered
UniverseResourceTypeof 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:
trueonly for the call that makes the transition.
-