Skip to content

Mod API

fayer3 edited this page Oct 11, 2025 · 2 revisions

An API for other mods to access Vivecrafts data is available since mod version 1.3.0. It provides the ability to get players pose data, register Trackers/Modules for Vivecraft to process for the local player, and provide information about the current render state.

Setup:

For now there is no dedicated API library to rely on in projects. Because of that it is recommended to just use the full mod from Modrinth/Curseforge maven as dependency.

Relying on the mod for 1.21.4 fabric from Modrinth would be declared like this:

modApi "maven.modrinth:vivecraft:1.21.4-1.3.0-fabric"

Running in dev

If you also want to be able to run Vivecraft in your development environment, you need to add the dependencies needed by Vivecraft, since the Modrinth maven doesn't auto add the jar in jar dependencies.

The dependencies differ slightly between MC version and mod loader.

Dependencies needed on all platforms:

runtimeOnly "com.illposed.osc:javaosc-core:0.9" 

We also need mixin extras 0.4.1+, if your modloader doesn't include that you need to add it manually. choose the one for your modloader.

As of writing this guide, that version is included in:

  • fabric loader 0.16.1+
  • neoforge 21.1.22
runtimeOnly "io.github.llamalad7:mixinextras-forge:0.4.1" 
runtimeOnly "io.github.llamalad7:mixinextras-fabric:0.4.1" 
runtimeOnly "io.github.llamalad7:mixinextras-neoforge:0.4.1" 

Dependencies that differ on MC version:

We use the lwjgl openvr bindings to interact with SteamVR, this version needs to match the lwjgl version used by Minecraft, or it will not work.

As of writing this guide these are the following:

  • 1.18.2 : 3.2.2
  • 1.19.2 - 1.20.4: 3.3.2
  • 1.20.5+: 3.3.3
runtimeOnly "org.lwjgl:lwjgl-openvr:${lwjgl_version}"
runtimeOnly "org.lwjgl:lwjgl-openvr:${lwjgl_version}:natives-linux"
runtimeOnly "org.lwjgl:lwjgl-openvr:${lwjgl_version}:natives-macos"
runtimeOnly "org.lwjgl:lwjgl-openvr:${lwjgl_version}:natives-windows"

Fabric

For fabric you'll need the fabric api, if you don't already have it as a dependency, and our config lib.

modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
runtimeOnly "com.electronwill.night-config:toml:3.6.6"
runtimeOnly "com.electronwill.night-config:core:3.6.6"

Example Mod

An example mod by hammy275 using some of the API features can be found here

Javadoc

The full javadoc is available here.

API Structure

The Api is structured into three parts client, common and server:

Client

Allows to interact with the local main player side of Vivecraft.

Allows to interact with the rendering side of Vivecraft.

Common

Allows to interact with the common side of Vivecraft, that are the same on client and server.

Server

Allows to interact with the server side of Vivecraft.

Clone this wiki locally