Class CowData

java.lang.Object
ch.njol.skript.entity.EntityData<org.bukkit.entity.Cow>
ch.njol.skript.entity.CowData
All Implemented Interfaces:
SyntaxElement, YggdrasilSerializable, YggdrasilSerializable.YggdrasilExtendedSerializable

public class CowData extends EntityData<org.bukkit.entity.Cow>
  • Constructor Details

    • CowData

      public CowData()
    • CowData

      public CowData(@Nullable @Nullable Object variant)
  • Method Details

    • init

      protected boolean init(Literal<?>[] exprs, int matchedPattern, SkriptParser.ParseResult parseResult)
      Description copied from class: EntityData
      Initializes this EntityData from the matched pattern and its associated literals.

      This is used when parsing entity data from user-written patterns such as "a saddled pig".

      Specified by:
      init in class EntityData<org.bukkit.entity.Cow>
      Parameters:
      exprs - An array of Literal 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 of null.
      matchedPattern - The index of the pattern which matched.
      parseResult - Additional information from the parser.
      Returns:
      true if initialization was successful, otherwise false.
    • init

      protected boolean init(@Nullable @Nullable Class<? extends org.bukkit.entity.Cow> entityClass, @Nullable @Nullable org.bukkit.entity.Cow cow)
      Description copied from class: EntityData
      Initializes this EntityData from either an entity class or a specific Entity.

      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 class EntityData<org.bukkit.entity.Cow>
      Parameters:
      entityClass - An entity's class, e.g. Player
      cow - An actual entity, or null to get an entity data for an entity class
      Returns:
      true if initialization was successful, otherwise false.
    • set

      public void set(org.bukkit.entity.Cow entity)
      Description copied from class: EntityData
      Applies this EntityData to a newly spawned Entity.

      This is used during entity spawning to set additional data, such as a saddled pig.

      Specified by:
      set in class EntityData<org.bukkit.entity.Cow>
      Parameters:
      entity - The spawned entity.
    • match

      protected boolean match(org.bukkit.entity.Cow entity)
      Description copied from class: EntityData
      Determines whether the given Entity matches this EntityData 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 class EntityData<org.bukkit.entity.Cow>
      Parameters:
      entity - The Entity to match.
      Returns:
      true if the entity matches, otherwise false.
    • getType

      public Class<org.bukkit.entity.Cow> getType()
      Description copied from class: EntityData
      Returns the Class of the Entity that this EntityData represents or handles.
      Specified by:
      getType in class EntityData<org.bukkit.entity.Cow>
      Returns:
      The entity's Class, such as Pig.class.
    • getSuperType

      public EntityData<org.bukkit.entity.Cow> getSuperType()
      Description copied from class: EntityData
      Returns a more general version of this EntityData with specific data removed.

      For example, calling this on "a saddled pig" would return "a pig". This is typically used to obtain the base entity type without any modifiers or traits.

      Specified by:
      getSuperType in class EntityData<org.bukkit.entity.Cow>
      Returns:
      A generalized EntityData representing the base entity type.
    • hashCode_i

      protected int hashCode_i()
      Description copied from class: EntityData
      Internal method used by EntityData.hashCode() to include subclass-specific fields in the hash calculation for this EntityData.
      Specified by:
      hashCode_i in class EntityData<org.bukkit.entity.Cow>
      Returns:
      A hash code representing subclass-specific data.
    • equals_i

      protected boolean equals_i(EntityData<?> obj)
      Description copied from class: EntityData
      Internal helper for EntityData.equals(Object) to compare the specific data of this EntityData with another.
      Specified by:
      equals_i in class EntityData<org.bukkit.entity.Cow>
      Parameters:
      obj - The EntityData to compare with.
      Returns:
      true if the data is considered equal, otherwise false.
    • isSupertypeOf

      public boolean isSupertypeOf(EntityData<?> entityData)
      Description copied from class: EntityData
      Determines whether this EntityData is a supertype of the given entityData.

      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 class EntityData<org.bukkit.entity.Cow>
      Parameters:
      entityData - The EntityData to compare against.
      Returns:
      true if this is a supertype of the given entity data, otherwise false.
    • setVariant

      public void setVariant(org.bukkit.entity.Cow cow)
      Due to the addition of 'AbstractCow' and 'api-version' being '1.19' This helper method is required in order to set the variant of the Cow
      Parameters:
      cow - The Cow to set the variant
    • setVariant

      public void setVariant(org.bukkit.entity.Cow cow, Object object)
      Due to the addition of 'AbstractCow' and 'api-version' being '1.19' This helper method is required in order to set the object of the Cow
      Parameters:
      cow - The Cow to set the variant
      object - The 'Cow.Variant'
    • getVariant

      @Nullable public @Nullable Object getVariant(org.bukkit.entity.Cow cow)
      Due to the addition of 'AbstractCow' and 'api-version' being '1.19' This helper method is required in order to get the 'Cow.Variant' of the Cow
      Parameters:
      cow - The Cow to get the variant
      Returns:
      The 'Cow.Variant'