World Data Persistence

Where The Last Sun stores apocalypse state, what survives restarts, and how saved data is attached to the world.

Updated 2026-11-14

The Last Sun stores apocalypse progress in the Overworld's saved data, not in player files. That means the state is shared by the world and survives restarts, server restarts, and player changes.

Tip

Because state is saved with the world, the reliable way to roll back apocalypse progress is to restore a world backup. Player-level resets do not affect it.

#Where state lives

Property Value
Saved data class ApocalypseState
Save name thelastsun_apocalypse
Storage type SavedData (dimension data storage)
Attached to Overworld level data
Data fix type DataFixTypes.LEVEL

The state is fetched through ApocalypseState.get(ServerLevel), which resolves to the server Overworld no matter which level triggered the call.

#What is saved

The saved-data codec writes these fields:

Field Default What it means
disappearanceGameTick -1 Scheduled disappearance game tick
graceEndRealTimeMs -1 Grace end in real time
apocalypseStartGameTick MIN_VALUE When the active apocalypse began
disappearanceScheduled false Whether a disappearance is scheduled
graceActive false Whether the grace period is running
darknessActive false Whether permanent darkness is active
stageId 0 Current climate stage id
lastWarningGameTick -1 Last warning message tick
ancientCityEnabled false Per-world Ancient City setting
wardenEnabled false Per-world Warden setting

#What this means

Situation Result
Server restarts Apocalypse state is loaded from saved data
World copied to another server Progress travels with the world
New player joins They see the world's current state
Single-player world reopened Progress resumes
Player relogs Their view is re-synced from world state

#Saving behavior

State is marked dirty with setDirty() when settings change. Climate and grace transitions also write state during normal server operation, so the save file is updated through the standard Minecraft saved-data pipeline.

#Not stored in world data

Item Storage
Client display values ClientApocalypseState (temporary)
Client settings preview ClientWorldSettingsState (temporary)
Config file values config/thelastsun.json
Important

Config values are not the same as world state. The config sets defaults and tuning, while per-world toggles and progress live in saved data.