Annotation Interface CapabilityInject


@Retention(RUNTIME) @Target({FIELD,METHOD}) @Deprecated(since="1.18", forRemoval=true) public @interface CapabilityInject
Deprecated, for removal: This API element is subject to removal in a future version.
When placed on a FIELD, the field will be set to an instance of Capability once that capability is registered. That field must be static and be able to hold a instance of 'Capability' Example:

 @CapabilityInject(IExampleCapability.class)
 private static final Capability<IExampleCapability> TEST_CAP = null;
 
When placed on a METHOD, the method will be invoked once the capability is registered. This allows you to have a 'enable features' callback. It MUST have one parameter of type 'Capability; Example:

 @CapabilityInject(IExampleCapability.class)
 private static void capRegistered(Capability<IExampleCapability> cap) {}
 
Warning: Capability injections are run in the thread that the capablity is registered. Due to parallel mod loading, this can potentially be off of the main thread.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    The capability interface to listen for registration.
  • Element Details

    • value

      Class<?> value
      Deprecated, for removal: This API element is subject to removal in a future version.
      The capability interface to listen for registration. Note: When reading annotations, DO NOT call this function as it will cause a hard dependency on the class.