Changes

37.0.42 update
Line 13: Line 13:     
== Creating Your Own Capability ==
 
== Creating Your Own Capability ==
In general terms, a capability is declared and registered through a single method call to <code><nowiki>CapabilityManager#INSTANCE#register</nowiki></code>. One possibility is to define a static <code><nowiki>register</nowiki></code> method inside a dedicated class for the capability, but this is not required by the capability system.
+
In general terms, a capability is registered through the event <code><nowiki>RegisterCapabilitiesEvent</nowiki></code> on the <code>MOD</code> event bus via the <code>#register</code> method.
    
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
CapabilityManager.INSTANCE.register(IExampleCapability.class);
+
@SubscribeEvent
 +
public void registerCaps(RegisterCapabilitiesEvent event) {
 +
    event.register(IExampleCapability.class);
 +
}
 
</syntaxhighlight>
 
</syntaxhighlight>