Package org.spongepowered.api.entity
Interface EntityArchetype
- All Superinterfaces:
Archetype<EntitySnapshot,
,Entity> CopyableDataHolder
,DataHolder
,DataHolder.Mutable
,DataSerializable
,SerializableDataHolder
,SerializableDataHolder.Mutable
,ValueContainer
-
Nested Class Summary
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
Modifier and TypeMethodDescriptionstatic EntityArchetype.Builder
builder()
Creates aEntityArchetype.Builder
to getEntityArchetype
s.copy()
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance.Gets the rawEntity
data that would be applied to the generated entity.static EntityArchetype
of
(EntityType<?> type) Creates a newEntityArchetype
with the specifiedEntityType
.void
setRawData
(DataView container) Attempts to set all data of thisDataHolder
according to theDataView
's held information.EntityType<?>
type()
Gets theEntityType
of the entity contained in 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 aEntityArchetype.Builder
to getEntityArchetype
s.- Returns:
- The new builder
-
of
Creates a newEntityArchetype
with the specifiedEntityType
.- Parameters:
type
- Type of the entity- Returns:
- An archetype of the given entity type
-
type
EntityType<?> type()Gets theEntityType
of the entity contained in this archetype.- Returns:
- The entity type
-
entityData
DataContainer entityData()Gets the rawEntity
data that would be applied to the generated entity. Note that this is a copied container.Note: While normally, an archetype does not contain position information, it is possible that
Queries.POSITION
are included as required bySchematic
s.- Returns:
- The copied container of the entity
-
setRawData
Description copied from interface:SerializableDataHolder.Mutable
Attempts to set all data of thisDataHolder
according to theDataView
's held information. Using this to modify known to beKey
s provided dynamically throughDataProvider
s is unsupported. The format of theDataView
's contained data is dependent on the type ofDataHolder.Mutable
this is. In some cases, the format is specified based on a more specific type, such as forEntityType
s, orItemType
s.This setter is used to provide setting custom data that is not represented by the Data API, including forge mods and other unknown data. Attempts to validate the provided view is not always possible due to the nature of the data being parsed by the implementation, and only understood by clients. Other cases where the data can be validated and the data is incompatible will end up throwing an
InvalidDataException
.- Specified by:
setRawData
in interfaceSerializableDataHolder.Mutable
- Parameters:
container
- A container containing all raw data to set on this data holder- Throws:
InvalidDataException
- If the container is missing or has invalid data that this holder will refuse
-
copy
EntityArchetype 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<EntitySnapshot,
Entity> - Specified by:
copy
in interfaceCopyableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder.Mutable
- Returns:
- The new copy
-