-
-
Notifications
You must be signed in to change notification settings - Fork 21
Visor lifecycle
Visor supports three play-modes. Each mode controls whether the VR session is initialized and when VR rendering occurs.
-
Behavior
- VR session initializes on startup and is playable from the main menu.
- Requires a VR runtime & hardware.
-
Behavior
- VR session initializes on startup but is playable only once you’re in-world.
- Requires a VR runtime & hardware.
-
Behavior
- VR session never initializes.
- Does not require VR runtime or hardware.
- Only modifies rendering of remote VR players (if connected to a server/plugin supporting Visor).
| Flag |
true means |
false means |
|---|---|---|
VR_INITIALIZED |
VR session has been created and is ready | No VR session is available; VR cannot render |
VR_ACTIVE |
VR is currently rendering | Rendering falls back to vanilla |
VR_FOCUSED |
VR is fully functional | In-game menu overlay shows; non-essential VR visuals disabled |
State is updated at the start of each MC game loop:
-
Initialization
- After MC resources finish loading, attempt to initialize VR.
- If successful, set
VR_INITIALIZED = true. - If in VR_DISABLED mode, skip initialization entirely.
-
Activation
- When
VR_INITIALIZED == trueand the HMD is put on, prepare the game for VR and setVR_ACTIVE = true. -
Edge case: If you remove the HMD on a non-vanilla server,
VR_ACTIVEremainstrue. - In VR_WORLD_ONLY mode, activation only occurs once you’re in-world.
- When
-
Focus
- When
VR_ACTIVE == trueand the VR session window has focus, setVR_FOCUSED = true.
- When
When VR throws an error at any point:
- If the player is in-world, leave the world.
- Destroy the VR session and set
VR_INITIALIZED = false. - Switch play-mode to
VR_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 extendable 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 extendable Visor elements, you won't need that mostly. Unless you want to have your logic active when VR_FOCUSED true