Add commodore for EntityType

This commit is contained in:
DerFrZocker 2024-06-09 15:06:22 +02:00
parent be9826c6e7
commit 139cc0c369
No known key found for this signature in database
GPG key ID: 713F71FFFE1DDF91

View file

@ -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();