Registration
StellarWorks.API.StellarWorksApi is the MelonLoader entry point. Call RegisterMod once during OnInitializeMelon on the game thread. Registration closes before world binding.
| Member | Behaviour |
|---|---|
IsAvailable | Indicates whether the framework API has initialised. |
RegisterMod(string id) | Claims the ID and uses the loose asset directory for that namespace. |
RegisterMod(string id, Assembly assetAssembly) | Claims the ID and uses assets embedded in the supplied assembly. |
Use the returned ModContext to register content, subscribe to events, and configure shortcuts. StellarWorks validates required gameplay hooks at startup. If one fails, the world cannot open and the MelonLoader compatibility report identifies the failed integration. Optional presentation integrations, such as the custom research UI, can fail independently.
When rebuilding a mod from a preview, pass the asset assembly directly for embedded assets and remove capability declarations and queries.
ModContext
| Accessor | Use |
|---|---|
Id, Logger | Namespace and scoped diagnostics. |
Parts, Components, Assets | Register parts and their behaviours, and access their models. |
Items, Fluids, Research, BuildCategories, ResearchCategories | Register owned content definitions. |
Content | Read definitions of registered parts, components, items, fluids, research, and categories. |
World, Events | Observe active sessions and subscribe to gameplay events. |
Persistence | Work with installation and authoritative world data. |
Configuration, Input, Console, Localization | Define mod settings, shortcuts, commands, and translated text. |
ContentRegistration<T>.Register(T definition) returns the registered definition. It requires an ID in the owning namespace and rejects duplicate IDs in that content family. Items and fluids share a native item ID space.
ContentId
Construct a key with new ContentId(owner, name) or parse a qualified key with ContentId.Parse("owner:name"). A segment is 1–64 lowercase ASCII letters, digits, underscores, periods, or hyphens. The segments . and .. are reserved. The mod namespaces native and stellarworks belong to the game and framework.
Use stable keys in saved data, addon contracts, and cross-mod references. The native numbers assigned to custom content belong to a world and are shared with connecting peers. Content definitions · Gameplay identities