Skip to main content

Provider API

Interface ID 1, version 2.0. Include <PAPER/Provider.h> (and <PAPER/Client.h> for the helper). Records live in paper::api, the table in paper::api::provider. Provider registers your mod as an owner; the owner token it issues is valid for every PAPER interface. Follow the discovery rules and the runtime contract.

Connect​

  1. Resolve PAPERAPI_QueryInterfaceV1 (kQueryExportName) from the loaded PAPER.dll. If PAPER is not loaded, keep running without its features.
  2. On the game thread, once PAPER is ready, paper::api::Client::connect(query, "Your mod", capabilities) queries Provider 2.0 and calls registerConsumer. A mod built for the pre-2.0 API is refused.
  3. Check client.grantedCapabilities() against the mask you requested.
  4. client.acquire(table) queries each further interface, such as PhysicalReload.
  5. client.close() on the game thread unregisters the owner and releases everything it holds.

Entry points​

Calls marked bool or count return that value instead of Status and fail closed with false or 0.

FunctionCapabilityThreadPurpose
getModVersionnoneAnyPAPER's version string, for example "1.2.0", valid for the process lifetime.
isReadynoneAnybool: PAPER's runtime is ready.
getRuntimeStateRuntimeStateGamebool: runtime snapshot.
getConfigStateRuntimeStateGamebool: configuration snapshot.
getCapturedTransformCountCapturedTransformsGamecount: native transforms captured this frame.
copyCapturedTransformsCapturedTransformsGamecount: copies up to kMaxCapturedTransforms (192) named local transforms.
getNativeHandPoseNativeHandPoseGamebool: hand-in-weapon plus 15 finger-local transforms for one hand.
registerConsumernoneGameRegisters a new owner. NotReady before isReady, OwnerConflict when the mod name is taken, CapacityReached beyond kMaxConsumers (16). Grants the requested bits PAPER knows.
unregisterConsumerownerGameEnds the owner's callbacks, authority request and physical-reload lease.
getGrantedCapabilitiesownerGamecount: the granted mask, 0 for an unknown owner.
setAnimationAuthorityAnimationAuthorityGameRequests native reload animation on arms, hands and/or weapon; lease 0 lasts until cleared, 1 to kMaxAuthorityLeaseFrames (1200) expires.
clearAnimationAuthorityAnimationAuthorityGameEnds the owner's authority request.
registerEventCallbackFrameCallbacksGameRegisters callback(event, userData), up to kMaxCallbacks (16).
unregisterEventCallbackFrameCallbacksGameRemoves one callback.
getNativePoseFrameStateNativePosePipelineGamePose-pipeline frame.
getNativeHandSolutionNativePosePipelineGameResolved solution of one hand.

Registration, events and authority​

  • ConsumerRegistration: modName[64], nonempty and NUL-terminated within the array, and requestedCapabilities (ConsumerCapability mask). The name is the owner's identity: one owner per name.
  • ConsumerHandle: ownerToken, grantedCapabilities, providerGeneration.
  • Event: kind (EventKind) and the frame's runtime state. Kinds: FrameComplete (1), RuntimeReset (2), ConfigReloaded (3), PresentationComplete (11); kinds 4 to 10 (weapon motion and manipulation) are retired and never reused. Callbacks run on the game thread inside PAPER's frame; the event is borrowed for the call. PresentationComplete is delivered only to owners with NativePosePipeline and does not advance leases.
  • AuthorityRequest: flags (NativeAnimationAuthorityFlag: arms, hands, weapon, or the combined reload pose) and leaseFrames. A nonzero lease expires after that many PAPER frame callbacks; zero persists until clear or owner unregistration. Authority coordinates an animation owner your mod already has; it submits no pose or IK data.

Native pose describes the pose-pipeline records. Shared types, results and bounds are in types and results; the full header is in complete declarations. A mod built against PAPER 1.2 is updated with migrating from PAPER 1.2.

paper::api::RuntimeState state{};
if (client.providerApi()->getRuntimeState(client.owner(), &state) &&
state.weaponGenerationKey != cachedWeaponKey) {
// the equipped weapon changed: drop weapon-specific caches
}