Interface BlockEntityArchetype
-
- All Superinterfaces:
Archetype<BlockSnapshot,BlockEntity>,CopyableDataHolder,DataHolder,DataHolder.Mutable,DataSerializable,SerializableDataHolder,SerializableDataHolder.Mutable,ValueContainer
public interface BlockEntityArchetype extends Archetype<BlockSnapshot,BlockEntity>
Represents the data of aBlockEntitywhich does not exist in the world and may be used to create newBlockEntitys with the same data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceBlockEntityArchetype.BuilderA builder forBlockEntityArchetypes.-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.Mutable
-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolder
SerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description DataContainerblockEntityData()Gets the rawBlockEntitydata that would be applied to the generated block entity.BlockEntityTypeblockEntityType()Gets theBlockEntityTypefor this archetype.static BlockEntityArchetype.Builderbuilder()Creates aBlockEntityArchetype.Builderto getBlockEntityArchetypes.BlockEntityArchetypecopy()Creates a clone copy of thisCopyableDataHolderas a newCopyableDataHoldersuch that all theValues are safely duplicated to the new instance.voidsetRawData(DataView container)Sets the raw data for the desiredBlockEntity.BlockStatestate()Gets the block state for this archetype.-
Methods inherited from interface org.spongepowered.api.world.Archetype
apply, toSnapshot
-
Methods inherited from interface org.spongepowered.api.data.DataHolder.Mutable
copyFrom, copyFrom, offer, offer, offer, offer, offerAll, offerAll, offerAll, offerAll, offerAll, offerAll, offerSingle, offerSingle, offerSingle, offerSingle, remove, remove, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeKey, removeKey, removeSingle, removeSingle, transform, transform, tryOffer, tryOffer, tryOffer, undo
-
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawData
-
-
-
-
Method Detail
-
builder
static BlockEntityArchetype.Builder builder()
Creates aBlockEntityArchetype.Builderto getBlockEntityArchetypes.- Returns:
- The new builder
-
state
BlockState state()
Gets the block state for this archetype. Note that this state is unchangeable, as much asblockEntityType()is. The underlying data is mutable, but all the data is heavily tied to the block entity type.- Returns:
- The block state
-
blockEntityType
BlockEntityType blockEntityType()
Gets theBlockEntityTypefor this archetype.- Returns:
- The block entity type
-
blockEntityData
DataContainer blockEntityData()
Gets the rawBlockEntitydata that would be applied to the generated block entity. Note that this is a copied container.The format used for this container follows the Mojang ChunkFormat for BlockEntities., and can be customized based on the origination of the
BlockEntity. If the block entity originates from a content-adding mod, the format could vary based on it's implementation and may change at any time.- Returns:
- The copied container of the block entity
-
setRawData
void setRawData(DataView container) throws InvalidDataException
Sets the raw data for the desiredBlockEntity. Note that position values are not used as those are dependent on usage.The format used for this container follows the Mojang ChunkFormat for BlockEntities., and can be customized based on the origination of the
BlockEntity. If the block entity originates from a content-adding mod, the format could vary based on it's implementation and may change at any time.- Specified by:
setRawDatain interfaceSerializableDataHolder.Mutable- Parameters:
container- A container containing all raw data to set on this data holder- Throws:
InvalidDataException- If the data is not valid for the archetyped block entity
-
copy
BlockEntityArchetype copy()
Description copied from interface:CopyableDataHolderCreates a clone copy of thisCopyableDataHolderas a newCopyableDataHoldersuch that all theValues are safely duplicated to the new instance. It is not guaranteed that the returning container is of the same type as this container.- Specified by:
copyin interfaceArchetype<BlockSnapshot,BlockEntity>- Specified by:
copyin interfaceCopyableDataHolder- Specified by:
copyin interfaceSerializableDataHolder- Specified by:
copyin interfaceSerializableDataHolder.Mutable- Returns:
- The new copy
-
-