Package ch.njol.skript.entity
Class SimpleEntityData
java.lang.Object
ch.njol.skript.entity.EntityData<org.bukkit.entity.Entity>
ch.njol.skript.entity.SimpleEntityData
- All Implemented Interfaces:
SyntaxElement
,YggdrasilSerializable
,YggdrasilSerializable.YggdrasilExtendedSerializable
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.njol.yggdrasil.YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable
-
Field Summary
Fields inherited from class ch.njol.skript.entity.EntityData
LANGUAGE_NODE, m_adult, m_age_pattern, m_baby, matchedPattern, serializer, WORLD_1_13_CONSUMER, WORLD_1_13_CONSUMER_METHOD, WORLD_1_17_CONSUMER, WORLD_1_17_CONSUMER_METHOD
-
Constructor Summary
ConstructorDescriptionSimpleEntityData
(Class<? extends org.bukkit.entity.Entity> c) SimpleEntityData
(org.bukkit.entity.Entity e) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSpawn
(@Nullable org.bukkit.World world) Check if this entity type can spawn.void
deserialize
(Fields fields) Deserializes this object.protected boolean
Deprecated.protected boolean
equals_i
(EntityData<?> obj) Returns the super type of this entity data, e.g.Class
<? extends org.bukkit.entity.Entity> getType()
protected int
protected boolean
init
(Literal<?>[] exprs, int matchedPattern, SkriptParser.ParseResult parseResult) protected boolean
boolean
isSupertypeOf
(EntityData<?> e) boolean
match
(org.bukkit.entity.Entity e) Serialises this object.void
set
(org.bukkit.entity.Entity entity) Methods inherited from class ch.njol.skript.entity.EntityData
equals, fromClass, fromEntity, getAgeAdjective, getAll, getAll, getAll, getInfo, getInfo, getName, hashCode, init, isBaby, isInstance, isPlural, onRegistrationStop, parse, parseWithoutIndefiniteArticle, register, register, spawn, spawn, spawn, spawn, toString, toString, toString, toString, toString, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser
-
Constructor Details
-
SimpleEntityData
public SimpleEntityData() -
SimpleEntityData
-
SimpleEntityData
public SimpleEntityData(org.bukkit.entity.Entity e)
-
-
Method Details
-
init
protected boolean init(Literal<?>[] exprs, int matchedPattern, SkriptParser.ParseResult parseResult) - Specified by:
init
in classEntityData<org.bukkit.entity.Entity>
-
init
protected boolean init(@Nullable @Nullable Class<? extends org.bukkit.entity.Entity> c, @Nullable @Nullable org.bukkit.entity.Entity e) - Specified by:
init
in classEntityData<org.bukkit.entity.Entity>
- Parameters:
c
- An entity's class, e.g. Playere
- An actual entity, or null to get an entity data for an entity class- Returns:
- Whether initialisation was successful
-
set
public void set(org.bukkit.entity.Entity entity) - Specified by:
set
in classEntityData<org.bukkit.entity.Entity>
-
match
public boolean match(org.bukkit.entity.Entity e) - Specified by:
match
in classEntityData<org.bukkit.entity.Entity>
-
getType
- Specified by:
getType
in classEntityData<org.bukkit.entity.Entity>
-
hashCode_i
protected int hashCode_i()- Specified by:
hashCode_i
in classEntityData<org.bukkit.entity.Entity>
-
equals_i
- Specified by:
equals_i
in classEntityData<org.bukkit.entity.Entity>
-
canSpawn
public boolean canSpawn(@Nullable @Nullable org.bukkit.World world) Description copied from class:EntityData
Check if this entity type can spawn.Some entity types may be restricted by experimental datapacks.
- Overrides:
canSpawn
in classEntityData<org.bukkit.entity.Entity>
- Parameters:
world
- World to check if entity can spawn in- Returns:
- True if entity can spawn else false
-
serialize
Description copied from interface:YggdrasilSerializable.YggdrasilExtendedSerializable
Serialises 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:
serialize
in interfaceYggdrasilSerializable.YggdrasilExtendedSerializable
- Overrides:
serialize
in classEntityData<org.bukkit.entity.Entity>
- 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
Description copied from interface:YggdrasilSerializable.YggdrasilExtendedSerializable
Deserializes 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:
deserialize
in interfaceYggdrasilSerializable.YggdrasilExtendedSerializable
- Overrides:
deserialize
in classEntityData<org.bukkit.entity.Entity>
- 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
-
deserialize
Deprecated.- Overrides:
deserialize
in classEntityData<org.bukkit.entity.Entity>
-
isSupertypeOf
- Specified by:
isSupertypeOf
in classEntityData<org.bukkit.entity.Entity>
-
getSuperType
Description copied from class:EntityData
Returns the super type of this entity data, e.g. 'wolf' for 'angry wolf'.- Specified by:
getSuperType
in classEntityData<org.bukkit.entity.Entity>
- Returns:
- The supertype of this entity data. Must not be null.
-