public class AttachCapabilitiesEvent<T>
extends net.minecraftforge.eventbus.api.GenericEvent<T>
Modifier and Type | Field and Description |
---|---|
private java.util.Map<ResourceLocation,ICapabilityProvider> |
caps |
private java.util.List<java.lang.Runnable> |
listeners |
private java.util.List<java.lang.Runnable> |
listenersView |
private T |
obj |
private java.util.Map<ResourceLocation,ICapabilityProvider> |
view |
Constructor and Description |
---|
AttachCapabilitiesEvent(java.lang.Class<T> type,
T obj) |
Modifier and Type | Method and Description |
---|---|
void |
addCapability(ResourceLocation key,
ICapabilityProvider cap)
Adds a capability to be attached to this object.
|
void |
addListener(java.lang.Runnable listener)
Adds a callback that is fired when the attached object is invalidated.
|
java.util.Map<ResourceLocation,ICapabilityProvider> |
getCapabilities()
A unmodifiable view of the capabilities that will be attached to this object.
|
java.util.List<java.lang.Runnable> |
getListeners() |
T |
getObject()
Retrieves the object that is being created, Not much state is set.
|
private final T obj
private final java.util.Map<ResourceLocation,ICapabilityProvider> caps
private final java.util.Map<ResourceLocation,ICapabilityProvider> view
private final java.util.List<java.lang.Runnable> listeners
private final java.util.List<java.lang.Runnable> listenersView
public T getObject()
public void addCapability(ResourceLocation key, ICapabilityProvider cap)
key
- The name of owner of this capability provider.cap
- The capability providerpublic java.util.Map<ResourceLocation,ICapabilityProvider> getCapabilities()
public void addListener(java.lang.Runnable listener)
public java.util.List<java.lang.Runnable> getListeners()