mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-04-13 09:41:09 +00:00
Add commodore for EntityType
This commit is contained in:
parent
be9826c6e7
commit
139cc0c369
1 changed files with 31 additions and 0 deletions
|
@ -360,6 +360,29 @@ public abstract class EntityType implements OldEnum<EntityType>, Keyed, Translat
|
|||
return (E) entityType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields this EntityType as a typed version of itself with a specific entity representing it.
|
||||
*
|
||||
* @param entityClass the class to type this {@link EntityType} with
|
||||
* @param <E> the generic type of the entity to type this particle with
|
||||
* @return the typed entity type
|
||||
* @throws IllegalArgumentException when the given class is not the same as {@link #getEntityClass()}
|
||||
* @throws UnsupportedOperationException when {@link #isTyped()} returns false
|
||||
* @see #isTyped()
|
||||
* @see #getEntityClass()
|
||||
*/
|
||||
@NotNull
|
||||
public abstract <E extends Entity> EntityType.Typed<E> typed(@NotNull Class<E> entityClass);
|
||||
|
||||
/**
|
||||
* Returns true if this EntityType is typed.
|
||||
*
|
||||
* @return true if this EntityType is typed
|
||||
* @see #getEntityClass()
|
||||
* @see #typed(Class)
|
||||
*/
|
||||
public abstract boolean isTyped();
|
||||
|
||||
/**
|
||||
* Some entities cannot be spawned using {@link
|
||||
* RegionAccessor#spawnEntity(Location, EntityType.Typed)} or {@link
|
||||
|
@ -372,6 +395,14 @@ public abstract class EntityType implements OldEnum<EntityType>, Keyed, Translat
|
|||
|
||||
public abstract boolean isAlive();
|
||||
|
||||
/**
|
||||
* Gets the Entity class of this EntityType.
|
||||
*
|
||||
* @return the entity class
|
||||
* @throws UnsupportedOperationException when {@link #isTyped()} returns false
|
||||
* @see #isTyped()
|
||||
* @see #typed(Class)
|
||||
*/
|
||||
@Nullable
|
||||
public abstract Class<? extends Entity> getEntityClass();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue