Server plugins
Plugin archives
A plugin (or mod: a plugin that adds content) ships as one .obby file in the server's plugins/ folder. Obsidian
reads two formats. Version 2 is the current one; version 1 files, packed by older Obsidian.MSBuild releases, still
load.
Version 2
A version 2 archive is a ZIP file, named .obby. Paths use / and are case-sensitive; none may start with / or
contain ...
| Path | Contents |
|---|---|
obsidian.mod.json |
Required. The plugin's metadata, see below. |
<Assembly>.dll |
Required. The plugin's main assembly, named by assembly in the metadata. |
<Assembly>.pdb, <Assembly>.deps.json |
Optional. Symbols, and the dependency manifest that lists the libraries to load. |
*.dll, *.pdb |
The plugin's private libraries from dotnet publish. |
assets/<namespace>/... |
Optional. Client resources (textures, models, translations), laid out like a resource pack, see below. |
data/<namespace>/... |
Optional. Server data laid out like a data pack; block, item and entity tags are read. |
Entries may be stored or deflated. Obsidian reads the file into memory once and decompresses each file when it is first needed, so the file on disk can be replaced while the plugin runs, which reloads it.
Building and packing
Reference Obsidian.API (and Obsidian.API.Client for a client side) without bundling it: ExcludeAssets="runtime"
on package references, or Private="false" on project references to an engine checkout. The host supplies these
assemblies and their dependencies, including CommunityToolkit.HighPerformance, logging and dependency-injection
abstractions, and SharpNoise, so they must not be bundled with a mod. The Obsidian.API package carries the
Obsidian.Nbt assembly it was built with; a project reference to the engine needs a direct Obsidian.Nbt project
reference with Private="false" too.
The Obsidian.MSBuild package, version 2.0 or later, packs a version
2 archive as the project builds, writing obsidian.mod.json from its properties. The template repositories
ObsidianMod (a mod for both sides) and
ObsidianPlugin (a server-side plugin) are set up this way.
Without it, give the metadata, assets/ and data/ files CopyToOutputDirectory="PreserveNewest" and publish into
an empty staging directory:
dotnet publish path/to/Mod.csproj -c Release --artifacts-path C:\tmp\mod-build -o C:\tmp\mod-staging
ZIP the staging contents (with obsidian.mod.json and the main DLL at the root, and / entry separators), and name
the archive .obby. Check its DLLs before distributing it: include the mod and its private libraries only. The
engine's test fixture, Obsidian.Tests.EngineSample, shows the project-reference setup. With project references,
build the engine normally once first, so that its generated vanilla assets exist (see the
build notes).
Metadata
obsidian.mod.json follows the fields of NeoForge's neoforge.mods.toml where the two overlap, written as JSON
(comments and trailing commas are allowed):
{
"modId": "ruby",
"displayName": "Ruby",
"version": "1.2.0",
"assembly": "Ruby",
"apiVersion": "1.0.0",
"authors": ["Tides"],
"description": "Adds rubies.",
"projectUrl": "https://example.com/ruby",
"issueTrackerURL": "https://example.com/ruby/issues",
"logoFile": "ruby.png",
"license": "MIT",
"credits": "Gem textures by Someone Else.",
"side": "both",
"dependencies": [
{ "modId": "gemlib", "type": "required", "versionRange": "[1.0,2.0)", "ordering": "after", "side": "both" }
]
}
| Field | Default | Meaning |
|---|---|---|
modId |
Required. The unique id other plugins depend on, and the namespace of what the plugin registers. | |
version |
Required. A version like 1.2.0; a prerelease label (1.2.0-beta) is accepted and ignored for ordering. |
|
assembly |
Required. The main assembly, without .dll. |
|
displayName |
modId |
The name shown to players and in logs. |
apiVersion |
empty | The Obsidian.API version the plugin was built against. |
side |
both |
Where the plugin runs: both, server or client. A server skips client plugins, and the Obsidian client, which loads mods from its mods folder, skips server ones. |
dependencies |
none | Other plugins, see below. |
issueTrackerURL |
none | Where players report bugs. The Obsidian client's mod list links it as Issues, and projectUrl as Website. |
logoFile |
none | A PNG in the archive, shown at 32 by 32 as the mod's icon in the client's mod list. Without one (or if it doesn't decode) the list shows a placeholder. |
license |
none | The license, as you name it, e.g. MIT. |
credits |
none | Thanks to people and projects, shown in the mod list. |
These four are named as in neoforge.mods.toml. Keys match case-insensitively, so issueTrackerUrl works too.
Each dependency has:
| Field | Default | Meaning |
|---|---|---|
modId |
Required. The other plugin's id. | |
type |
required |
required: must be present with an accepted version. optional: if present, must have an accepted version. incompatible: this plugin doesn't load while an accepted version is present. discouraged: only warns. |
versionRange |
any | Accepted versions, as a Maven/NuGet range ([1.0,2.0)) or a minimum version (1.0). |
ordering |
none |
after loads the dependency first, before loads this plugin first. With none, a present dependency still loads first (so that the plugin can use its types), unless other orderings contradict that for an optional one. A required dependency can't be ordered before: Obsidian has to load it first. |
side |
both |
The side the dependency applies to; on the other side it is ignored. |
Plugins load in dependency order; among plugins that are free to load, by id. The constraints of plugins already loaded apply to plugins that arrive later too: a plugin another one declares incompatible doesn't load. A plugin that can't load yet (say, its required dependency is missing) waits, and is tried again whenever plugins load or unload.
The services a plugin registers can take, in their constructors, its other services, the singletons registered by
the plugins it depends on, IServer, the server configuration and loggers. Its [Inject] properties can also get the
server's other services.
Assets
The Obsidian client reads a mod's assets/ as a resource pack, one per mod in load order, above vanilla's assets and
below the player's resource packs (and servers' packs). It's laid out like a resource pack's, usually under the mod's
own namespace, its modId:
| Path | Contents |
|---|---|
assets/<ns>/blockstates/<block>.json |
The models of the states of the block <ns>:<block>. |
assets/<ns>/models/... |
Block and item models, referred to as <ns>:block/<name> and <ns>:item/<name>. |
assets/<ns>/textures/block/..., textures/item/... |
Textures, referred to as <ns>:block/<name> and <ns>:item/<name>, each with an optional .png.mcmeta that animates it. |
assets/<ns>/items/<item>.json |
The definition (the model) of the item <ns>:<item>. |
assets/<ns>/lang/<language>.json |
Translations, merged with vanilla's and other mods' per language. |
assets/<ns>/models/entity/<path>.json, textures/entity/... |
Entity model layers and textures, for the mod's entity renderers (see The client). |
assets/<ns>/particles/<particle>.json |
Particle sprite sets, for the particle <ns>:<particle>. |
assets/<ns>/sounds.json, sounds/... |
Sound events and their files. |
For a block ruby:ruby_block and its item:
assets/ruby/blockstates/ruby_block.json
{"variants": {"": {"model": "ruby:block/ruby_block"}}}
assets/ruby/models/block/ruby_block.json
{"parent": "minecraft:block/cube_all", "textures": {"all": "ruby:block/ruby_block"}}
assets/ruby/textures/block/ruby_block.png
assets/ruby/items/ruby_block.json
{"model": {"type": "minecraft:model", "model": "ruby:block/ruby_block"}}
assets/ruby/lang/en_us.json
{"block.ruby.ruby_block": "Block of Ruby"}
A pack.mcmeta is optional; a mod that has one gets its filter and overlays applied like a resource pack's. Only
assets/ is read, within the client's resource pack limits. Version 1 archives have no assets.
- A block's faces are drawn in the render layer their texture needs: solid when it's opaque, cutout with fully transparent pixels, and translucent with partly transparent ones.
- A block model can choose the layer itself with NeoForge's
render_type, which its children inherit:"render_type": "minecraft:cutout", orsolid,cutout_mipped(drawn as cutout) ortranslucent. - A texture's
<name>.png.mcmetaanimates it like vanilla's water and fire, with vanilla'sanimationfields:frametime,frames,interpolate,widthandheight. - A model element with vanilla's
light_emission, from 0 to 15, lights its faces at least that much however dark it is around them: a lamp's glowing core or a machine's display. It doesn't light other blocks, which the block'sLightEmissiondoes.
{
"parent": "minecraft:block/block",
"render_type": "minecraft:cutout",
"textures": {"cage": "ruby:block/lamp_cage", "core": "ruby:block/lamp_core", "particle": "#cage"},
"elements": [
{"from": [0, 0, 0], "to": [16, 16, 16], "faces": {"north": {"texture": "#cage"}, "up": {"texture": "#cage"}}},
{"from": [5, 5, 5], "to": [11, 11, 11], "light_emission": 15, "faces": {"north": {"texture": "#core"}}}
]
}
Reloading
Changing a plugin's file reloads the plugin, and deleting it unloads it. The plugins that depend on it reload, or wait, with it, since they use its types. A plugin may reload itself from one of its own commands.
Unloading removes everything the plugin registered (commands, event handlers, services, payload channels, argument parsers) and what it added through the server's services (dialogs, recipes, scoreboards, boss bars, generators; see the mod system). New calls into the plugin stop, and it's released once the running ones end.
Content a plugin registered, like its items, keeps its identity and ids while the server runs: reloading the plugin gives the same items their new behaviour, and unloading it leaves them registered, without behaviour, until the server stops.
A plugin must not leave references to its own types with the server or other plugins outside what it registered, or it can't unload, and it can't load or unload plugins from its own load, ready or unloading callbacks.
Version 1
Version 1 archives, packed by older Obsidian.MSBuild releases, are a binary format beginning with OBBY: a header
with the plugin's metadata and a hash that catches damaged files, then the files. If one of the files is
obsidian.mod.json, its metadata replaces the header's, which gives version 1 plugins the dependency types, ordering
and side above.