Interface BlockEntityArchetype
- All Superinterfaces:
Archetype<BlockSnapshot,,BlockEntity> CopyableDataHolder,DataHolder,DataHolder.Mutable,DataSerializable,SerializableDataHolder,SerializableDataHolder.Mutable,ValueContainer
Represents the data of a
BlockEntity which does not exist in the world
and may be used to create new BlockEntitys with the same data.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.MutableNested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolder
SerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable -
Method Summary
Modifier and TypeMethodDescriptionGets the rawBlockEntitydata that would be applied to the generated block entity.Gets theBlockEntityTypefor this archetype.static BlockEntityArchetype.Builderbuilder()Creates aBlockEntityArchetype.Builderto getBlockEntityArchetypes.copy()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.state()Gets the block state for this archetype.Methods inherited from interface org.spongepowered.api.world.Archetype
apply, toSnapshotMethods 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, undoMethods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainerMethods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawData
-
Method Details
-
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
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
-