Class EntityData<E extends org.bukkit.entity.Entity>
java.lang.Object
ch.njol.skript.entity.EntityData<E>
- All Implemented Interfaces:
SyntaxElement, YggdrasilSerializable, YggdrasilSerializable.YggdrasilExtendedSerializable
- Direct Known Subclasses:
EntityData
@Deprecated(forRemoval=true,
since="2.17")
public abstract class EntityData<E extends org.bukkit.entity.Entity>
extends Object
implements SyntaxElement, YggdrasilSerializable.YggdrasilExtendedSerializable
Deprecated, for removal: This API element is subject to removal in a future version.
-
Nested Class Summary
Nested classes/interfaces inherited from interface YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.static Serializer<EntityData> Deprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionabstract booleancanSpawn(@Nullable org.bukkit.World world) Deprecated, for removal: This API element is subject to removal in a future version.Checks whether this entity type is allowed to spawn in the givenWorld.abstract Ecreate()Deprecated, for removal: This API element is subject to removal in a future version.Creates an entity in the server but does not spawn itabstract Ecreate(org.bukkit.Location location) Deprecated, for removal: This API element is subject to removal in a future version.Creates an entity at the provided location, but does not spawn it NOTE: IfRegionAccessor.createEntity(Location, Class)does not exist, will returnspawn(Location)abstract voiddeserialize(Fields fields) Deprecated, for removal: This API element is subject to removal in a future version.Deserializes this object.abstract booleanDeprecated, for removal: This API element is subject to removal in a future version.static <E extends org.bukkit.entity.Entity>
EntityData<? super E> Deprecated, for removal: This API element is subject to removal in a future version.Creates anEntityDatathat represents the given entity class.static <E extends org.bukkit.entity.Entity>
EntityData<? super E> fromEntity(E entity) Deprecated, for removal: This API element is subject to removal in a future version.Creates anEntityDatathat represents the given entity instance.static <E extends org.bukkit.entity.Entity>
E[]getAll(EntityData<?>[] types, Class<E> type, org.bukkit.Chunk[] chunks) Deprecated, for removal: This API element is subject to removal in a future version.static <E extends org.bukkit.entity.Entity>
E[]getAll(EntityData<?>[] types, Class<E> type, org.bukkit.World @Nullable [] worlds) Deprecated, for removal: This API element is subject to removal in a future version.abstract E[]getAll(org.bukkit.World... worlds) Deprecated, for removal: This API element is subject to removal in a future version.abstract @NotNull EntityData<?> Deprecated, for removal: This API element is subject to removal in a future version.Returns a more general version of thisEntityDatawith specific data removed.abstract @NotNull StringDeprecated, for removal: This API element is subject to removal in a future version.getType()Deprecated, for removal: This API element is subject to removal in a future version.abstract inthashCode()Deprecated, for removal: This API element is subject to removal in a future version.abstract KleeneanisBaby()Deprecated, for removal: This API element is subject to removal in a future version.abstract booleanisInstance(@Nullable org.bukkit.entity.Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.abstract KleeneanisPlural()Deprecated, for removal: This API element is subject to removal in a future version.abstract booleanisSupertypeOf(EntityData<?> entityData) Deprecated, for removal: This API element is subject to removal in a future version.Determines whether thisEntityDatais a supertype of the givenentityData.static @Nullable EntityData<?> Deprecated, for removal: This API element is subject to removal in a future version.Prints errors.static @Nullable EntityData<?> parseWithoutIndefiniteArticle(String string) Deprecated, for removal: This API element is subject to removal in a future version.Prints errors.abstract FieldsDeprecated, for removal: This API element is subject to removal in a future version.Serialises this object.abstract voidDeprecated, for removal: This API element is subject to removal in a future version.Applies thisEntityDatato a newly spawnedEntity.abstract Espawn(org.bukkit.Location location) Deprecated, for removal: This API element is subject to removal in a future version.Spawn this entity data at a location.abstract EDeprecated, for removal: This API element is subject to removal in a future version.Spawn this entity data at a location.abstract StringtoString()Deprecated, for removal: This API element is subject to removal in a future version.abstract StringtoString(int flags) Deprecated, for removal: This API element is subject to removal in a future version.static StringDeprecated, for removal: This API element is subject to removal in a future version.static StringDeprecated, for removal: This API element is subject to removal in a future version.static StringtoString(org.bukkit.entity.Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.static StringtoString(org.bukkit.entity.Entity entity, int flags) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from interface SyntaxElement
getParser, init, preInit
-
Field Details
-
LANGUAGE_NODE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
serializer
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
EntityData
public EntityData()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
parse
Deprecated, for removal: This API element is subject to removal in a future version.Prints errors.- Parameters:
string- String with optional indefinite article at the beginning- Returns:
- The parsed entity data
-
parseWithoutIndefiniteArticle
Deprecated, for removal: This API element is subject to removal in a future version.Prints errors.- Parameters:
string-- Returns:
- The parsed entity data
-
getAll
public static <E extends org.bukkit.entity.Entity> E[] getAll(EntityData<?>[] types, Class<E> type, org.bukkit.World @Nullable [] worlds) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
types-type-worlds- worlds or null for all- Returns:
- All entities of this type in the given worlds
-
getAll
public static <E extends org.bukkit.entity.Entity> E[] getAll(EntityData<?>[] types, Class<E> type, org.bukkit.Chunk[] chunks) Deprecated, for removal: This API element is subject to removal in a future version. -
fromClass
public static <E extends org.bukkit.entity.Entity> EntityData<? super E> fromClass(Class<E> entityClass) Deprecated, for removal: This API element is subject to removal in a future version.Creates anEntityDatathat represents the given entity class.- Parameters:
entityClass- The class of the entity (e.g.Pig.class).- Returns:
- An
EntityDatarepresenting the provided class.
-
fromEntity
Deprecated, for removal: This API element is subject to removal in a future version.Creates anEntityDatathat represents the given entity instance.- Parameters:
entity- The entity to represent.- Returns:
- An
EntityDatarepresenting the provided entity.
-
toString
Deprecated, for removal: This API element is subject to removal in a future version. -
toString
-
toString
Deprecated, for removal: This API element is subject to removal in a future version. -
toString
-
set
Deprecated, for removal: This API element is subject to removal in a future version.Applies thisEntityDatato a newly spawnedEntity.This is used during entity spawning to set additional data, such as a saddled pig.
- Parameters:
entity- The spawned entity.
-
getType
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- The entity's
Class, such asPig.class.
-
getSuperType
Deprecated, for removal: This API element is subject to removal in a future version.Returns a more general version of thisEntityDatawith specific data removed.For example, calling this on
"a saddled pig"should return"a pig". This is typically used to obtain the base entity type without any modifiers or traits.- Returns:
- A generalized
EntityDatarepresenting the base entity type.
-
toString
-
toString
Deprecated, for removal: This API element is subject to removal in a future version. -
isPlural
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
Kleeneandetermining whether thisEntityDatais representing plurality.
-
isBaby
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
Kleeneandetermining whether thisEntityDatais representing baby type.
-
hashCode
-
equals
-
canSpawn
public abstract boolean canSpawn(@Nullable @Nullable org.bukkit.World world) Deprecated, for removal: This API element is subject to removal in a future version.Checks whether this entity type is allowed to spawn in the givenWorld.Some entity types may be restricted from spawning due to experimental datapacks.
- Parameters:
world- The world to check spawning permissions in.- Returns:
trueif the entity can be spawned in the given world, or in general if world isnull; otherwisefalse.
-
spawn
Deprecated, for removal: This API element is subject to removal in a future version.Spawn this entity data at a location.- Parameters:
location- TheLocationto spawn the entity at.- Returns:
- The Entity object that is spawned.
-
spawn
@Nullable public abstract E spawn(org.bukkit.Location location, @Nullable @Nullable Consumer<E> consumer) Deprecated, for removal: This API element is subject to removal in a future version.Spawn this entity data at a location. The consumer allows for modification to the entity before it actually gets spawned.- Parameters:
location- TheLocationto spawn the entity at.consumer- AConsumerto apply the entity changes to.- Returns:
- The Entity object that is spawned.
-
getAll
Deprecated, for removal: This API element is subject to removal in a future version. -
isInstance
public abstract boolean isInstance(@Nullable @Nullable org.bukkit.entity.Entity entity) Deprecated, for removal: This API element is subject to removal in a future version. -
isSupertypeOf
Deprecated, for removal: This API element is subject to removal in a future version.Determines whether thisEntityDatais a supertype of the givenentityData.This is used to check whether the current entity data represents a broader category than another. For example:
if a zombie is a monster: # passes: "monster" is a supertype of "zombie" if a monster is a zombie: # fails: "zombie" is not a supertype of "monster"- Parameters:
entityData- TheEntityDatato compare against.- Returns:
trueif this is a supertype of the given entity data, otherwisefalse.
-
serialize
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:YggdrasilSerializable.YggdrasilExtendedSerializableSerialises this object. Only fields contained in the returned Fields object will be written to stream.You can use return new
Fields(this); to emulate the default behaviour.- Specified by:
serializein interfaceYggdrasilSerializable.YggdrasilExtendedSerializable- Returns:
- A Fields object containing all fields that should be written to stream
- Throws:
NotSerializableException- If this object or one of its fields is not serializable
-
deserialize
public abstract void deserialize(Fields fields) throws StreamCorruptedException, NotSerializableException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:YggdrasilSerializable.YggdrasilExtendedSerializableDeserializes this object. No fields have been set when this method is called, use fields.setFields(this, yggdrasil) to set all compatible non-transient and non-static fields (and call incompatible/missing field handlers if applicable – this implies that errors will be thrown if the fields object is invalid).You can use fields.
setFields(this); to emulate the default behaviour.- Specified by:
deserializein interfaceYggdrasilSerializable.YggdrasilExtendedSerializable- Parameters:
fields- A Fields object containing all fields read from stream- Throws:
StreamCorruptedException- If the Fields object is invalid, i.e. was not written byYggdrasilSerializable.YggdrasilExtendedSerializable.serialize()or Yggdrasil's default serialisation.NotSerializableException
-
getSyntaxTypeName
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getSyntaxTypeNamein interfaceSyntaxElement- Returns:
- A string naming the type of syntax this is. e.g. "expression", "section".
-
create
Deprecated, for removal: This API element is subject to removal in a future version.Creates an entity in the server but does not spawn it- Returns:
- The created entity
-
create
Deprecated, for removal: This API element is subject to removal in a future version.Creates an entity at the provided location, but does not spawn it NOTE: IfRegionAccessor.createEntity(Location, Class)does not exist, will returnspawn(Location)- Parameters:
location- TheLocationto create the entity at- Returns:
- The created entity
-
EntityDatainstead.