public abstract class AbstractEntityDataProcessor<E extends net.minecraft.entity.Entity,M extends org.spongepowered.api.data.manipulator.DataManipulator<M,I>,I extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<I,M>> extends AbstractMultiDataProcessor<M,I>
Modifier | Constructor and Description |
---|---|
protected |
AbstractEntityDataProcessor(Class<E> entityClass) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
doesDataExist(E entity) |
Optional<M> |
from(org.spongepowered.api.data.DataHolder dataHolder)
Attempts to get the given
DataManipulator of type T if
and only if the manipulator's required data exists from the
DataHolder . |
protected abstract Map<org.spongepowered.api.data.key.Key<?>,?> |
getValues(E entity) |
org.spongepowered.api.data.DataTransactionResult |
set(org.spongepowered.api.data.DataHolder dataHolder,
M manipulator,
org.spongepowered.api.data.merge.MergeFunction function)
Sets the data from the
DataManipulator . |
protected abstract boolean |
set(E entity,
Map<org.spongepowered.api.data.key.Key<?>,Object> keyValues) |
boolean |
supports(org.spongepowered.api.data.DataHolder dataHolder) |
protected boolean |
supports(E entity) |
boolean |
supports(org.spongepowered.api.entity.EntityType entityType) |
Optional<I> |
with(org.spongepowered.api.data.key.Key<? extends org.spongepowered.api.data.value.BaseValue<?>> key,
Object value,
I immutable) |
createFrom, createManipulator, fill
getPriority
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fill, remove
protected boolean supports(E entity)
protected abstract boolean doesDataExist(E entity)
protected abstract boolean set(E entity, Map<org.spongepowered.api.data.key.Key<?>,Object> keyValues)
public boolean supports(org.spongepowered.api.data.DataHolder dataHolder)
public Optional<M> from(org.spongepowered.api.data.DataHolder dataHolder)
DataProcessor
DataManipulator
of type T
if
and only if the manipulator's required data exists from the
DataHolder
. This is conceptually different from
DataProcessor.createFrom(DataHolder)
since a new instance
isn't returned even if the DataManipulator
is applicable.
This is a processor method for CompositeValueStore.get(Class)
.
dataHolder
- The data holderpublic org.spongepowered.api.data.DataTransactionResult set(org.spongepowered.api.data.DataHolder dataHolder, M manipulator, org.spongepowered.api.data.merge.MergeFunction function)
DataProcessor
DataManipulator
. Usually, if a
DataHolder
is being offered a DataManipulator
with a
MergeFunction
, the MergeFunction
logic should always
be settled first, before offering the finalized DataManipulator
to the DataHolder
. In the case of implementation, what really
happens is that all pre-logic before data is actually "offered" to a
DataHolder
, the data is filtered for various reasons from
various plugins. After the data is finished being manipulated
by the various sources, including the possibly provided
MergeFunction
, the DataManipulator
is finally offered
to the DataHolder
. The resulting DataTransactionResult
is almost always made ahead of time.dataHolder
- The data holder to set the data ontomanipulator
- The manipulator to set the data frompublic Optional<I> with(org.spongepowered.api.data.key.Key<? extends org.spongepowered.api.data.value.BaseValue<?>> key, Object value, I immutable)
public boolean supports(org.spongepowered.api.entity.EntityType entityType)
supports
in interface DataProcessor<M extends org.spongepowered.api.data.manipulator.DataManipulator<M,I>,I extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<I,M>>
supports
in class AbstractSpongeDataProcessor<M extends org.spongepowered.api.data.manipulator.DataManipulator<M,I>,I extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<I,M>>