Class BlockTransaction
- java.lang.Object
-
- org.spongepowered.api.data.Transaction<BlockSnapshot>
-
- org.spongepowered.api.block.transaction.BlockTransaction
-
- All Implemented Interfaces:
DataSerializable
public final class BlockTransaction extends Transaction<BlockSnapshot>
A specializedTransaction<BlockSnapshot>
that covers the required changes of oneBlockSnapshot
to another, with the added benefit of a contextual understanding of what sort ofoperation
is being performed to change from one block to another. It is possible to serialize a particular transaction, but to associate a transaction with it's "post" state, refer tothe receipt variant
that exposes only what was and what is the final result.
-
-
Constructor Summary
Constructors Constructor Description BlockTransaction(BlockSnapshot original, BlockSnapshot defaultReplacement, @Nullable java.util.List<? extends BlockSnapshot> intermediary, Operation operation)
BlockTransaction(BlockSnapshot original, BlockSnapshot defaultReplacement, Operation operation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
contentVersion()
Gets the content version of thisDataSerializable
.boolean
equals(java.lang.Object obj)
int
hashCode()
Operation
operation()
DataContainer
toContainer()
Serializes this object into a comprehensibleDataContainer
.java.lang.String
toString()
-
Methods inherited from class org.spongepowered.api.data.Transaction
custom, defaultReplacement, finalReplacement, intermediary, invalidate, isValid, original, setCustom, setValid, validate
-
-
-
-
Constructor Detail
-
BlockTransaction
public BlockTransaction(BlockSnapshot original, BlockSnapshot defaultReplacement, Operation operation)
-
BlockTransaction
public BlockTransaction(BlockSnapshot original, BlockSnapshot defaultReplacement, @Nullable java.util.List<? extends BlockSnapshot> intermediary, Operation operation)
-
-
Method Detail
-
operation
public Operation operation()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classTransaction<BlockSnapshot>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classTransaction<BlockSnapshot>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classTransaction<BlockSnapshot>
-
contentVersion
public int contentVersion()
Description copied from interface:DataSerializable
Gets the content version of thisDataSerializable
. The version may differ between instances of plugins and implementations such that theDataView
fromDataSerializable.toContainer()
may include different information, or remove other information as they are no longer deemed necessary. The version goes hand in hand withDataContentUpdater
as it is required when there exists anyDataView
of thisDataSerializable
with an "older" version.- Specified by:
contentVersion
in interfaceDataSerializable
- Overrides:
contentVersion
in classTransaction<BlockSnapshot>
- Returns:
- The version of the content being serialized
-
toContainer
public DataContainer toContainer()
Description copied from interface:DataSerializable
Serializes this object into a comprehensibleDataContainer
.- Specified by:
toContainer
in interfaceDataSerializable
- Overrides:
toContainer
in classTransaction<BlockSnapshot>
- Returns:
- A newly created DataContainer
-
-