You register your capability with
CapabilityManager.register
in preInit. You attach providers for your capability to external objects (
Entities
,
TileEntities
,
ItemStack
s, etc.) when
AttachCapabilitiesEvent<T>
is fired.
For examples of capabilities, you can look at the capability test mod or my own mod's capabilities (API, implementation).
The
IMaxHealth
capability in my mod will probably be of particular interest, this is attached to entities to store and manage an
AttributeModifier
to provide bonus max health.