Class SimpleProvider<A>

java.lang.Object
org.moddingx.libx.capability.SimpleProvider<A>
All Implemented Interfaces:
net.minecraftforge.common.capabilities.ICapabilityProvider

public class SimpleProvider<A> extends Object implements net.minecraftforge.common.capabilities.ICapabilityProvider
A simple capability provider for a single capability that is lazily initialised. For all other capabilities, a parent provider will be queried.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimpleProvider(net.minecraftforge.common.capabilities.Capability<A> capability, Supplier<A> value)
    Creates a new SimpleProvider that provides the value from the given supplier for the given capability.
    SimpleProvider(net.minecraftforge.common.capabilities.Capability<A> capability, LazyValue<A> value)
    Creates a new SimpleProvider that provides the given value for the given capability.
    SimpleProvider(net.minecraftforge.common.capabilities.ICapabilityProvider parent, net.minecraftforge.common.capabilities.Capability<A> capability, Supplier<A> value)
    Creates a new SimpleProvider that provides the value from the given supplier for the given capability.
    SimpleProvider(net.minecraftforge.common.capabilities.ICapabilityProvider parent, net.minecraftforge.common.capabilities.Capability<A> capability, LazyValue<A> value)
    Creates a new SimpleProvider that provides the given value for the given capability.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> net.minecraftforge.common.util.LazyOptional<T>
    getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, net.minecraft.core.Direction side)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability
  • Constructor Details

    • SimpleProvider

      public SimpleProvider(net.minecraftforge.common.capabilities.Capability<A> capability, Supplier<A> value)
      Creates a new SimpleProvider that provides the value from the given supplier for the given capability. The supplier will only be invoked once.
    • SimpleProvider

      public SimpleProvider(net.minecraftforge.common.capabilities.Capability<A> capability, LazyValue<A> value)
      Creates a new SimpleProvider that provides the given value for the given capability.
    • SimpleProvider

      public SimpleProvider(@Nullable net.minecraftforge.common.capabilities.ICapabilityProvider parent, net.minecraftforge.common.capabilities.Capability<A> capability, Supplier<A> value)
      Creates a new SimpleProvider that provides the value from the given supplier for the given capability. The supplier will only be invoked once.
      Parameters:
      parent - The parent provider used for other capabilities.
    • SimpleProvider

      public SimpleProvider(@Nullable net.minecraftforge.common.capabilities.ICapabilityProvider parent, net.minecraftforge.common.capabilities.Capability<A> capability, LazyValue<A> value)
      Creates a new SimpleProvider that provides the given value for the given capability.
      Parameters:
      parent - The parent provider used for other capabilities.
  • Method Details

    • getCapability

      @Nonnull public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull net.minecraftforge.common.capabilities.Capability<T> cap, @Nullable net.minecraft.core.Direction side)
      Specified by:
      getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider