-
Notifications
You must be signed in to change notification settings - Fork 3
Visor lifecycle
Bogdan edited this page Jul 30, 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, initializes VisorClient, client-related classes and addons
- If VRPlayMode is not DISABLED, attempts to initialize VR session.
- If successful, VRStateMode changes to
INITIALIZED.
-
Activation
- When VRStateMode is
INITIALIZEDand the current VRPlayMode allows active VR, prepares the game for VR and changes state-mode toACTIVE. -
Edge case: If you are on a server not supporting vanilla, VRStateMode will remain
ACTIVE.
- When VRStateMode is
-
Focus
- When VRStateMode is
ACTIVEand the VR session window has focus, VRStateMode changed toFOCUSED, otherwise goes back toACTIVE
- When VRStateMode 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 is initially created for non-VR 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 is true