-
-
Notifications
You must be signed in to change notification settings - Fork 21
Visor lifecycle
Bogdan T. edited this page Jun 13, 2025
·
31 revisions
API classes related to lifecycle:
To access, you need to use VisorAPI#clientState() method
State is updated at the beginning of Minecraft game loop:
-
Initialization
- After MC resources finish loading, attempt to initialize VR.
- If successful, state-mode changes to
INITIALIZED. - If in DISABLED play-mode, skip initialization entirely.
-
Activation
- When state-mode is
INITIALIZEDand the HMD is put on, prepares the game for VR and changes state-mode toACTIVE. -
Edge case: If you take off the HMD on a server not supporting vanilla, state-mode will remain
ACTIVE. - In WORLD_ONLY play-mode, activation only occurs once you’re in-world.
- When state-mode is
-
Focus
- When state-mode is
ACTIVEand the VR session window has focus, state-mode changed toFOCUSED, otherwise goes back toACTIVE
- When state-mode is
When VR throws an error at any point:
- If the player is in-world, disconnect.
- Destroy the VR session and set state-mode to
OFF. - Switch play-mode to
DISABLED. - Show the VR error screen.
You should avoid any modifications of Visor Lifecycle to not risk the instability and issues with other addons
Make sure your addon checks whether VR is currently active/focused to run your logic if you are doing something outside of Visor elements scope.
It is especially important when you use mixin to modify minecraft for VR or your mod initially is created for vanilla minecraft and you want to add support for VR.
For Visor elements, you won't need that mostly. Unless you want to have your logic active when VR_FOCUSED true