Skip to main content
Hytale ships with a GameMode enum (Adventure, Creative) and a GameModeType asset system that defines permissions and interactions for each mode. If your mod changes behavior based on the current game mode - disabling PvP in Creative, unlocking build tools, restricting commands - you need to verify that mode detection and mode switching work correctly. The ChangeGameModeEvent fires when a player’s mode changes. Mods that react to mode switches (enabling fly in Creative, locking inventory in Adventure) should capture this event and verify the new mode value.

Complete Example Suite

GameMode Enum

ValueDescription
GameMode.AdventureStandard gameplay with survival mechanics
GameMode.CreativeUnrestricted building and flying

GameModeType Asset

GameModeType is the content asset tied to each GameMode. It defines what the mode allows:
MethodReturnsDescription
fromGameMode(GameMode)GameModeTypeResolve the asset for a mode
getPermissionGroups()String[]Permission groups active in this mode
getInteractionsOnEnter()StringInteractions triggered when entering the mode

ChangeGameModeEvent

Fires when a player’s game mode changes. Key methods:
MethodReturnsDescription
getGameMode()GameModeThe new game mode being switched to
setGameMode(GameMode)voidOverride the target mode
setCancelled(boolean)voidCancel the mode switch
isCancelled()booleanCheck if the switch was cancelled

When to Test Game Modes

  • Mode-gated features - your mod enables/disables systems per mode
  • Permission checks - Creative players get different permissions than Adventure
  • Event listeners - your mod reacts to ChangeGameModeEvent
  • UI changes - different HUD elements per mode

Isolation Recommendation

Game mode tests are read-only enum and asset lookups. IsolationStrategy.NONE is sufficient unless you are modifying player state:

Next Steps

  • Players - mock player creation and game mode assignment
  • Events - event capture and cancellation patterns
  • Permissions - permission checks per game mode