Migrate a CMAPI 0.5.x mod to 0.6.0
CMAPI 0.6.0 keeps the 0.5.x player, event, logging, and console-command contracts. Existing mods that use only those members generally need no source changes.
For a build that intentionally requires 0.6.0, reference the new CMAPI.API.dll and update the manifest:
{
"MinimumApiVersion": "0.6.0"
}Do not raise the minimum just because 0.6.0 exists. Keep the oldest version the mod actually supports so players receive an accurate compatibility message.
New read-only services
IModHelper adds:
Items, anIItemManagerwithAllItems,TryGetItem, andFindItems;TerraTokens, anITerraTokenManagerwithIsAvailableandCount.
Both services are Unity-free. Catalog snapshots can be empty at the main menu, and Terra Tokens are unavailable until the relevant game system exists. Query them after LocalPlayerStarted when world state is required.
helper.Events.Player.LocalPlayerStarted += _ =>
{
foreach (IItemDefinition item in helper.Items.FindItems("iron"))
Monitor.Info($"{item.Id}: {item.DisplayName}");
if (helper.TerraTokens.IsAvailable)
Monitor.Info($"Terra Tokens: {helper.TerraTokens.Count}");
};Why mutation is not public yet
The 0.6.0 built-in give_item and give_money commands use internal adapters with host checks, bounds validation, capacity checks, and Planet Crafter's network-aware APIs. CMAPI does not yet expose those adapters to mods. A public mutation contract needs stable asynchronous results and explicit authority semantics so a client mod cannot silently mutate someone else's world.
Mods should not use reflection to call the built-in command internals. Use the read-only services now and wait for the public mutation service if network-safe world changes are required.