@Beta public class AddEffector extends java.lang.Object implements EntityInitializer
This instance provides a newEffectorBuilder(Class, ConfigBag)
which returns an abstract (body-less) effector defining:
EFFECTOR_NAME
;
EFFECTOR_DESCRIPTION
EFFECTOR_PARAMETER_DEFS
Callers should pass the effector to instantiate into the constructor.
Often subclasses will supply a constructor which takes a ConfigBag of parameters,
and a custom newEffectorBuilder(Class, ConfigBag)
which adds the body
before passing to this class.
Note that the parameters passed to the call method in the body of the effector implementation
are only those supplied by a user at runtime; in order to merge with default
values, use getMergedParams(Effector, ConfigBag)
.
Modifier and Type | Field and Description |
---|---|
static ConfigKey<java.lang.String> |
EFFECTOR_DESCRIPTION |
static ConfigKey<java.lang.String> |
EFFECTOR_NAME |
static ConfigKey<java.util.Map<java.lang.String,java.lang.Object>> |
EFFECTOR_PARAMETER_DEFS |
Constructor and Description |
---|
AddEffector(Effector<?> effector) |
Modifier and Type | Method and Description |
---|---|
void |
apply(EntityLocal entity)
Applies initialization logic to a just-built entity.
|
static ConfigBag |
getMergedParams(Effector<?> eff,
ConfigBag params)
returns a ConfigBag containing the merger of the supplied parameters with default values on the effector-defined parameters
|
static <T> Effectors.EffectorBuilder<T> |
newEffectorBuilder(java.lang.Class<T> type,
ConfigBag params) |
public static final ConfigKey<java.lang.String> EFFECTOR_NAME
public static final ConfigKey<java.lang.String> EFFECTOR_DESCRIPTION
public static final ConfigKey<java.util.Map<java.lang.String,java.lang.Object>> EFFECTOR_PARAMETER_DEFS
public AddEffector(Effector<?> effector)
public void apply(EntityLocal entity)
EntityInitializer
apply
in interface EntityInitializer
entity
- guaranteed to be the actual implementation instance,
thus guaranteed to be castable to EntityInternal which is often desired,
or to the type at hand (it is not even a proxy)public static <T> Effectors.EffectorBuilder<T> newEffectorBuilder(java.lang.Class<T> type, ConfigBag params)