Class CapabilityProvider<B extends CapabilityProvider<B>>

    • Field Detail

      • SUPPORTS_LAZY_CAPABILITIES

        static boolean SUPPORTS_LAZY_CAPABILITIES
      • valid

        private boolean valid
      • isLazy

        private boolean isLazy
      • lazyParentSupplier

        private java.util.function.Supplier<ICapabilityProvider> lazyParentSupplier
      • initialized

        private boolean initialized
    • Constructor Detail

      • CapabilityProvider

        protected CapabilityProvider​(java.lang.Class<B> baseClass)
      • CapabilityProvider

        protected CapabilityProvider​(java.lang.Class<B> baseClass,
                                     boolean isLazy)
    • Method Detail

      • gatherCapabilities

        protected final void gatherCapabilities()
      • gatherCapabilities

        protected final void gatherCapabilities​(@Nullable
                                                ICapabilityProvider parent)
      • gatherCapabilities

        protected final void gatherCapabilities​(@Nullable
                                                java.util.function.Supplier<ICapabilityProvider> parent)
      • doGatherCapabilities

        private void doGatherCapabilities​(@Nullable
                                          ICapabilityProvider parent)
      • areCapsCompatible

        public final boolean areCapsCompatible​(@Nullable
                                               CapabilityDispatcher other)
      • serializeCaps

        @Nullable
        protected final CompoundNBT serializeCaps()
      • deserializeCaps

        protected final void deserializeCaps​(CompoundNBT tag)
      • invalidateCaps

        protected void invalidateCaps()
      • reviveCaps

        protected void reviveCaps()
      • getCapability

        @Nonnull
        public <T> LazyOptional<T> getCapability​(@Nonnull
                                                 Capability<T> cap,
                                                 @Nullable
                                                 Direction side)
        Description copied from interface: ICapabilityProvider
        Retrieves the Optional handler for the capability requested on the specific side. The return value CAN be the same for multiple faces. Modders are encouraged to cache this value, using the listener capabilities of the Optional to be notified if the requested capability get lost.
        Specified by:
        getCapability in interface ICapabilityProvider
        Returns:
        The requested an optional holding the requested capability.