Enum Class EntityType

java.lang.Object
java.lang.Enum<EntityType>
org.bukkit.entity.EntityType
All Implemented Interfaces:
Serializable, Comparable<EntityType>, Constable, net.kyori.adventure.key.Keyed, Translatable, Keyed, Translatable

public enum EntityType extends Enum<EntityType> implements Keyed, Translatable, Translatable
  • Enum Constant Details

  • Method Details

    • values

      public static EntityType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EntityType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getName

      Deprecated.
      Magic value
      Gets the entity type name.
      Returns:
      the entity type's name
    • getKey

      @NotNull public @NotNull NamespacedKey getKey()
      Description copied from interface: Keyed
      Return the namespaced identifier for this object.
      Specified by:
      getKey in interface Keyed
      Returns:
      this object's key
    • getEntityClass

      @Nullable public @Nullable Class<? extends Entity> getEntityClass()
    • getTypeId

      @Deprecated public short getTypeId()
      Deprecated.
      Magic value
      Gets the entity type id.
      Returns:
      the raw type id
    • fromName

      @Deprecated @Contract("null -> null") @Nullable public static @Nullable EntityType fromName(@Nullable @Nullable String name)
      Deprecated.
      Magic value
      Gets an entity type from its name.
      Parameters:
      name - the entity type's name
      Returns:
      the matching entity type or null
    • fromId

      @Deprecated @Nullable public static @Nullable EntityType fromId(int id)
      Deprecated.
      Magic value
      Gets an entity from its id.
      Parameters:
      id - the raw type id
      Returns:
      the matching entity type or null
    • isSpawnable

      public boolean isSpawnable()
      Some entities cannot be spawned using RegionAccessor.spawnEntity(Location, EntityType) or RegionAccessor.spawn(Location, Class), usually because they require additional information in order to spawn.
      Returns:
      False if the entity type cannot be spawned
    • isAlive

      public boolean isAlive()
    • getTranslationKey

      @NotNull @Deprecated(forRemoval=true) public @NotNull String getTranslationKey()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Translatable
      Get the translation key, suitable for use in a translation component.
      Specified by:
      getTranslationKey in interface Translatable
      Returns:
      the translation key
    • translationKey

      @NotNull public @NotNull String translationKey()
      Description copied from interface: net.kyori.adventure.translation.Translatable
      Gets the translation key.
      Specified by:
      translationKey in interface Translatable
      Returns:
      the translation key
      Throws:
      IllegalArgumentException - if the entity does not have a translation key (is probably a custom entity)
    • hasDefaultAttributes

      public boolean hasDefaultAttributes()
      Checks if the entity has default attributes.
      Returns:
      true if it has default attributes
    • getDefaultAttributes

      @NotNull public Attributable getDefaultAttributes()
      Gets the default attributes for the entity.
      Returns:
      an unmodifiable instance of Attributable for reading default attributes.
      Throws:
      IllegalArgumentException - if the entity does not exist of have default attributes (use hasDefaultAttributes() first)
    • isEnabledByFeature

      public boolean isEnabledByFeature(@NotNull @NotNull World world)
      Gets if this EntityType is enabled by feature in a world.
      Parameters:
      world - the world to check
      Returns:
      true if this EntityType can be used to spawn an Entity for this World.