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 BlockEntity
s 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.Mutable
Nested 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 rawBlockEntity
data that would be applied to the generated block entity.Gets theBlockEntityType
for this archetype.static BlockEntityArchetype.Builder
builder()
Creates aBlockEntityArchetype.Builder
to getBlockEntityArchetype
s.copy()
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance.void
setRawData
(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, 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 Details
-
builder
Creates aBlockEntityArchetype.Builder
to getBlockEntityArchetype
s.- 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 theBlockEntityType
for this archetype.- Returns:
- The block entity type
-
blockEntityData
DataContainer blockEntityData()Gets the rawBlockEntity
data 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:
setRawData
in 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:CopyableDataHolder
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s 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:
copy
in interfaceArchetype<BlockSnapshot,
BlockEntity> - Specified by:
copy
in interfaceCopyableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder.Mutable
- Returns:
- The new copy
-