From e578e72b466b1bc76f42f853d1e1dce6140dfee8 Mon Sep 17 00:00:00 2001 From: Brychan Dempsey Date: Sun, 13 Jun 2021 14:06:26 +1200 Subject: [PATCH] Version change to 1.0.0 --- javaecs/pom.xml | 2 +- .../java/nz/ac/massey/javaecs/ComponentManager.java | 11 +++++++++++ .../src/main/java/nz/ac/massey/javaecs/Engine.java | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/javaecs/pom.xml b/javaecs/pom.xml index 8b8f346..6d9ad2e 100644 --- a/javaecs/pom.xml +++ b/javaecs/pom.xml @@ -2,7 +2,7 @@ 4.0.0 nz.ac.massey.javaecs javaecs - 0.9.9-RELEASE_CANDIDATE + 1.0.0 1.8 1.8 diff --git a/javaecs/src/main/java/nz/ac/massey/javaecs/ComponentManager.java b/javaecs/src/main/java/nz/ac/massey/javaecs/ComponentManager.java index 169e4a7..00e5143 100644 --- a/javaecs/src/main/java/nz/ac/massey/javaecs/ComponentManager.java +++ b/javaecs/src/main/java/nz/ac/massey/javaecs/ComponentManager.java @@ -152,4 +152,15 @@ class ComponentManager{ componentArrays.get(componentType).remove(entity); return true; } + + /** + * Checks if the entity contains data for the provided component + * @param entity the entity to check + * @param componentType the component class type + * @return true if the entity has component data + */ + public boolean entityHasComponentData(Entity entity, Type componentType){ + if (componentArrays.get(componentType).containsKey(entity)) return true; + else return false; + } } \ No newline at end of file diff --git a/javaecs/src/main/java/nz/ac/massey/javaecs/Engine.java b/javaecs/src/main/java/nz/ac/massey/javaecs/Engine.java index c8e2f5a..1ce71a4 100644 --- a/javaecs/src/main/java/nz/ac/massey/javaecs/Engine.java +++ b/javaecs/src/main/java/nz/ac/massey/javaecs/Engine.java @@ -116,6 +116,16 @@ public class Engine { return entityManager.getNumEntities(); } + /** + * Checks if the entity is subscribed to the provided type + * @param entity the entity to search + * @param componentType the class type of the component to search + * @return true if the entity is subscribed + */ + public boolean entityHasComponent(Entity entity, Type componentType){ + return entityManager.getRegistrations(entity).get(componentManager.getComponentIndex(componentType)); + } + /*************************************** ** Manage Components ** ***************************************/