Skip to content

Offline Mode

Hudkit can run without a connection to Studio by using offline mode, this provides you total control over how Hudkit works inside your project. Offline mode works with a mock Studio server that allows you to set the XML of your HUD with a single function call.

Create a HudManager with offline options:

val hudManager = HudManager(
studioOptions = StudioOptions.offline(),
)

In offline mode, you provide the HUD definition XML directly using setOfflineXML():

// Load XML from a file
val xml = File("hud.xml").readText()
// Set the XML definition
hudManager.setOfflineXML(xml)
// Load and process the definition
val definition = hudManager.loadDefinition().process()
hudManager.definition = definition

In offline mode, you cannot use uploadResourcepack(). You must host the resoucepack yourself. You can get access to the resourcepack from the processed defenition.

val definition = hudManager.loadDefinition()
val resourcepack = definition.process().resourcepack
File("resourcepack.zip").writeBytes(resourcepack)
// ... host the resoucepack
hudManager.resourcepackUrl = "https://example.com/resourcepack.zip"
// Now you can send it to players
hudManager.sendResourcepack(player)