From 139cc0c36981dc526d9b9ca5536a4cde4fc370da Mon Sep 17 00:00:00 2001 From: DerFrZocker Date: Sun, 9 Jun 2024 15:06:22 +0200 Subject: [PATCH] Add commodore for EntityType --- .../java/org/bukkit/entity/EntityType.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java index 5745f0c9..63c44074 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java @@ -360,6 +360,29 @@ public abstract class EntityType implements OldEnum, 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 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 EntityType.Typed typed(@NotNull Class 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, 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 getEntityClass();