public abstract class AbstractTileEntitySingleDataProcessor<E extends net.minecraft.tileentity.TileEntity,T,V extends org.spongepowered.api.data.value.BaseValue<T>,M extends org.spongepowered.api.data.manipulator.DataManipulator<M,I>,I extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<I,M>> extends AbstractSingleDataProcessor<T,V,M,I>
key
Constructor and Description |
---|
AbstractTileEntitySingleDataProcessor(Class<E> tileEntityClass,
org.spongepowered.api.data.key.Key<V> key) |
Modifier and Type | Method and Description |
---|---|
protected abstract org.spongepowered.api.data.value.immutable.ImmutableValue<T> |
constructImmutableValue(T value) |
Optional<M> |
fill(org.spongepowered.api.data.DataContainer container,
M m) |
Optional<M> |
fill(org.spongepowered.api.data.DataHolder dataHolder,
M manipulator,
org.spongepowered.api.data.merge.MergeFunction overlap) |
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 Optional<T> |
getVal(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,
T value) |
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
getPriority, supports
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
remove
protected boolean supports(E tileEntity)
protected abstract org.spongepowered.api.data.value.immutable.ImmutableValue<T> constructImmutableValue(T value)
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 Optional<M> fill(org.spongepowered.api.data.DataHolder dataHolder, M manipulator, org.spongepowered.api.data.merge.MergeFunction overlap)
fill
in interface DataProcessor<M extends org.spongepowered.api.data.manipulator.DataManipulator<M,I>,I extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<I,M>>
fill
in class AbstractSingleDataProcessor<T,V extends org.spongepowered.api.data.value.BaseValue<T>,M extends org.spongepowered.api.data.manipulator.DataManipulator<M,I>,I extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<I,M>>
public 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