Changes

52 bytes removed ,  20:06, 20 August 2021
37.0.42 update
Line 455: Line 455:  
capability's presence. The registration requires specifying only the Capability Interface.
 
capability's presence. The registration requires specifying only the Capability Interface.
   −
The registration can be performed by calling the <code>register</code> method on the <code>CapabilityManager</code>.
+
The registration can be performed by calling the <code>register</code> method within the <code>RegisterCapabilitiesEvent</code> which is fired on the <code>MOD</code> event bus. The
This '''needs''' to happen when the <code>FMLCommonSetupEvent</code> is fired on the <code>MOD</code> event bus. The
   
registration will also automatically inject the created Capability into all relevant fields and methods: refer to
 
registration will also automatically inject the created Capability into all relevant fields and methods: refer to
 
[[#Obtaining a Capability|Obtaining a Capability]] for more information.
 
[[#Obtaining a Capability|Obtaining a Capability]] for more information.
Line 463: Line 462:     
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
public void onCommonSetup(FMLCommonSetupEvent event) {
+
@SubscribeEvent
     CapabilityManager.INSTANCE.register(MyCapability.class);
+
public void registerCaps(RegisterCapabilitiesEvent event) {
 +
     event.register(MyCapability.class);
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>