Enum CapabilityManager
- java.lang.Object
-
- java.lang.Enum<CapabilityManager>
-
- net.minecraftforge.common.capabilities.CapabilityManager
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CapabilityManager>
public enum CapabilityManager extends java.lang.Enum<CapabilityManager>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Field Summary
Fields Modifier and Type Field Description private java.util.IdentityHashMap<java.lang.String,java.util.List<java.util.function.Function<Capability<?>,java.lang.Object>>>
callbacks
private static org.objectweb.asm.Type
CAP_INJECT
private static org.apache.logging.log4j.Logger
LOGGER
private java.util.IdentityHashMap<java.lang.String,Capability<?>>
providers
-
Constructor Summary
Constructors Modifier Constructor Description private
CapabilityManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
attachCapabilityToMethod(java.util.Map<java.lang.String,java.util.List<java.util.function.Function<Capability<?>,java.lang.Object>>> cbs, net.minecraftforge.forgespi.language.ModFileScanData.AnnotationData entry)
void
injectCapabilities(java.util.List<net.minecraftforge.forgespi.language.ModFileScanData> data)
<T> void
register(java.lang.Class<T> type, Capability.IStorage<T> storage, java.util.concurrent.Callable<? extends T> factory)
Registers a capability to be consumed by others.static CapabilityManager
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static CapabilityManager[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final CapabilityManager INSTANCE
-
-
Field Detail
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
CAP_INJECT
private static final org.objectweb.asm.Type CAP_INJECT
-
providers
private final java.util.IdentityHashMap<java.lang.String,Capability<?>> providers
-
callbacks
private volatile java.util.IdentityHashMap<java.lang.String,java.util.List<java.util.function.Function<Capability<?>,java.lang.Object>>> callbacks
-
-
Method Detail
-
values
public static CapabilityManager[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CapabilityManager c : CapabilityManager.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CapabilityManager valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
register
public <T> void register(java.lang.Class<T> type, Capability.IStorage<T> storage, java.util.concurrent.Callable<? extends T> factory)
Registers a capability to be consumed by others. APIs who define the capability should call this. To retrieve the Capability instance, use the @CapabilityInject annotation. This method is safe to call during parallel mod loading.- Parameters:
type
- The Interface to be registeredstorage
- A default implementation of the storage handler.factory
- A Factory that will produce new instances of the default implementation.
-
injectCapabilities
public void injectCapabilities(java.util.List<net.minecraftforge.forgespi.language.ModFileScanData> data)
-
attachCapabilityToMethod
private static void attachCapabilityToMethod(java.util.Map<java.lang.String,java.util.List<java.util.function.Function<Capability<?>,java.lang.Object>>> cbs, net.minecraftforge.forgespi.language.ModFileScanData.AnnotationData entry)
-
-