public abstract class AbstractTileEntityDataProcessor<E extends net.minecraft.tileentity.TileEntity,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 |
AbstractTileEntityDataProcessor(Class<E> tileEntityClass) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
doesDataExist(E tileEntity) |
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 tileEntity) |
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 tileEntity,
Map<org.spongepowered.api.data.key.Key<?>,Object> keyValues) |
boolean |
supports(org.spongepowered.api.data.DataHolder dataHolder) |
protected boolean |
supports(E tileEntity) |
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, supports
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fill, remove
protected boolean supports(E tileEntity)
protected abstract boolean doesDataExist(E tileEntity)
protected abstract boolean set(E tileEntity, 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 from