Annotation Type CapabilityInject


  • @Retention(RUNTIME)
    @Target({FIELD,METHOD})
    public @interface CapabilityInject
    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 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 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
      java.lang.Class<?> value
      The capability interface to listen for registration.
    • Element Detail

      • value

        java.lang.Class<?> value
        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.