Class FallingBlockData
- 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
codeNameIndex, LANGUAGE_NODE, m_adult, m_age_pattern, m_baby, serializer, WORLD_1_17_CONSUMER, WORLD_1_17_CONSUMER_METHOD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
equals_i
(EntityData<?> entityData) Internal helper forEntityData.equals(Object)
to compare the specific data of thisEntityData
with another.@NotNull EntityData
<?> Returns a more general version of thisEntityData
with specific data removed.Class
<? extends org.bukkit.entity.FallingBlock> getType()
protected int
Internal method used byEntityData.hashCode()
to include subclass-specific fields in the hash calculation for thisEntityData
.protected boolean
init
(Literal<?>[] exprs, int matchedCodeName, int matchedPattern, SkriptParser.ParseResult parseResult) Initializes thisEntityData
.protected boolean
init
(@Nullable Class<? extends org.bukkit.entity.FallingBlock> entityClass, @Nullable org.bukkit.entity.FallingBlock fallingBlock) Initializes thisEntityData
from either an entity class or a specificEntity
.boolean
isSupertypeOf
(EntityData<?> entityData) Determines whether thisEntityData
is a supertype of the givenentityData
.protected boolean
match
(org.bukkit.entity.FallingBlock fallingBlock) Determines whether the givenEntity
matches thisEntityData
data.void
set
(org.bukkit.entity.FallingBlock fallingBlock) Applies thisEntityData
to a newly spawnedEntity
.@Nullable org.bukkit.entity.FallingBlock
Spawn this entity data at a location.toString
(int flags) Methods inherited from class ch.njol.skript.entity.EntityData
canSpawn, create, create, create, dataMatch, deserialize, equals, fromClass, fromEntity, getAgeAdjective, getAll, getAll, getAll, getInfo, getInfo, getName, getSyntaxTypeName, hashCode, init, isBaby, isInstance, isPlural, kleeneanMatch, kleeneanMatch, onRegistrationStop, parse, parseWithoutIndefiniteArticle, register, register, serialize, spawn, spawn, spawn, 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, preInit
-
Constructor Details
-
FallingBlockData
public FallingBlockData() -
FallingBlockData
-
-
Method Details
-
init
protected boolean init(Literal<?>[] exprs, int matchedCodeName, int matchedPattern, SkriptParser.ParseResult parseResult) Description copied from class:EntityData
Initializes thisEntityData
.As of Skript 2.13, code names can have multiple patterns registered in the default.lang file.
matchedCodeName
will be the index of the code name the matched pattern is linked to. (e.g.PigData
"unsaddled pig' = 0, "pig" = 1, "saddled pig" = 2)matchedPattern
will be the index of the pattern used from the patterns of the code name in the lang file.- Specified by:
init
in classEntityData<org.bukkit.entity.FallingBlock>
- Parameters:
exprs
- An array ofLiteral
expressions from the matched pattern, in the order they appear. If an optional value was omitted by the user, it will still be present in the array with a value ofnull
.matchedCodeName
- The index of the code name which matched.matchedPattern
- The index of the pattern of the code name which matched.parseResult
- Additional information from the parser.- Returns:
true
if initialization was successful, otherwisefalse
.
-
init
protected boolean init(@Nullable @Nullable Class<? extends org.bukkit.entity.FallingBlock> entityClass, @Nullable @Nullable org.bukkit.entity.FallingBlock fallingBlock) Description copied from class:EntityData
Initializes thisEntityData
from either an entity class or a specificEntity
.Example usage:
spawn a pig at location(0, 0, 0): set {_entity} to event-entity spawn {_entity} at location(0, 0, 0)
- Specified by:
init
in classEntityData<org.bukkit.entity.FallingBlock>
- Parameters:
entityClass
- An entity's class, e.g. PlayerfallingBlock
- An actual entity, or null to get an entity data for an entity class- Returns:
true
if initialization was successful, otherwisefalse
.
-
set
public void set(org.bukkit.entity.FallingBlock fallingBlock) Description copied from class:EntityData
Applies thisEntityData
to a newly spawnedEntity
.This is used during entity spawning to set additional data, such as a saddled pig.
- Specified by:
set
in classEntityData<org.bukkit.entity.FallingBlock>
- Parameters:
fallingBlock
- The spawned entity.
-
match
protected boolean match(org.bukkit.entity.FallingBlock fallingBlock) Description copied from class:EntityData
Determines whether the givenEntity
matches thisEntityData
data.For example:
spawn a pig at location(0, 0, 0): set {_entity} to event-entity if {_entity} is a pig: # will pass if {_entity} is a saddled pig: # will not pass
- Specified by:
match
in classEntityData<org.bukkit.entity.FallingBlock>
- Parameters:
fallingBlock
- TheEntity
to match.- Returns:
true
if the entity matches, otherwisefalse
.
-
getType
Description copied from class:EntityData
- Specified by:
getType
in classEntityData<org.bukkit.entity.FallingBlock>
- Returns:
- The entity's
Class
, such asPig.class
.
-
getSuperType
Description copied from class:EntityData
Returns a more general version of thisEntityData
with 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.- Specified by:
getSuperType
in classEntityData<org.bukkit.entity.FallingBlock>
- Returns:
- A generalized
EntityData
representing the base entity type.
-
hashCode_i
protected int hashCode_i()Description copied from class:EntityData
Internal method used byEntityData.hashCode()
to include subclass-specific fields in the hash calculation for thisEntityData
.- Specified by:
hashCode_i
in classEntityData<org.bukkit.entity.FallingBlock>
- Returns:
- A hash code representing subclass-specific data.
-
equals_i
Description copied from class:EntityData
Internal helper forEntityData.equals(Object)
to compare the specific data of thisEntityData
with another.- Specified by:
equals_i
in classEntityData<org.bukkit.entity.FallingBlock>
- Parameters:
entityData
- TheEntityData
to compare with.- Returns:
true
if the data is considered equal, otherwisefalse
.
-
isSupertypeOf
Description copied from class:EntityData
Determines whether thisEntityData
is 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"
- Specified by:
isSupertypeOf
in classEntityData<org.bukkit.entity.FallingBlock>
- Parameters:
entityData
- TheEntityData
to compare against.- Returns:
true
if this is a supertype of the given entity data, otherwisefalse
.
-
spawn
@Nullable public @Nullable org.bukkit.entity.FallingBlock spawn(org.bukkit.Location loc, @Nullable @Nullable Consumer<org.bukkit.entity.FallingBlock> consumer) Description copied from class:EntityData
Spawn this entity data at a location. The consumer allows for modification to the entity before it actually gets spawned.- Overrides:
spawn
in classEntityData<org.bukkit.entity.FallingBlock>
- Parameters:
loc
- TheLocation
to spawn the entity at.consumer
- AConsumer
to apply the entity changes to.- Returns:
- The Entity object that is spawned.
-
toString
- Overrides:
toString
in classEntityData<org.bukkit.entity.FallingBlock>
-