diff --git a/engine-tests/src/test/java/org/terasology/entitySystem/BaseEntityRefTest.java b/engine-tests/src/test/java/org/terasology/entitySystem/BaseEntityRefTest.java index 248e80cc6d0..186c28b969e 100644 --- a/engine-tests/src/test/java/org/terasology/entitySystem/BaseEntityRefTest.java +++ b/engine-tests/src/test/java/org/terasology/entitySystem/BaseEntityRefTest.java @@ -42,13 +42,10 @@ import static org.terasology.entitySystem.entity.internal.EntityScope.GLOBAL; import static org.terasology.entitySystem.entity.internal.EntityScope.SECTOR; -/** - */ public class BaseEntityRefTest { private static Context context; private PojoEntityManager entityManager; - //private Prefab prefab; private EntityRef ref; @BeforeClass diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/EntityManager.java b/engine/src/main/java/org/terasology/entitySystem/entity/EntityManager.java index 51e2cf43037..fe86c743198 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/EntityManager.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/EntityManager.java @@ -21,16 +21,17 @@ import org.terasology.entitySystem.event.internal.EventSystem; import org.terasology.entitySystem.metadata.ComponentLibrary; import org.terasology.entitySystem.prefab.PrefabManager; +import org.terasology.entitySystem.sectors.SectorSimulationComponent; import java.util.Map; -/** - */ public interface EntityManager extends EntityPool { /** * Creates a new EntityRef in sector-scope * + * @param maxDelta the maximum delta for the sector entity's simulations + * @see SectorSimulationComponent#maxDelta * @return the newly created EntityRef */ default EntityRef createSectorEntity(long maxDelta) { @@ -38,7 +39,6 @@ default EntityRef createSectorEntity(long maxDelta) { } /** - * @param other * @return A new entity with a copy of each of the other entity's components * @deprecated Use EntityRef.copy() instead. */ @@ -48,7 +48,6 @@ default EntityRef createSectorEntity(long maxDelta) { /** * Creates a copy of the components of an entity. * - * @param original * @return A map of components types to components copied from the target entity. */ // TODO: Remove? A little dangerous due to ownership diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/EntityPool.java b/engine/src/main/java/org/terasology/entitySystem/entity/EntityPool.java index 118b27fdefe..d7eb8f58b21 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/EntityPool.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/EntityPool.java @@ -20,8 +20,6 @@ import org.terasology.math.geom.Quat4f; import org.terasology.math.geom.Vector3f; -/** - */ public interface EntityPool { /** @@ -82,7 +80,6 @@ public interface EntityPool { EntityRef create(String prefabName); /** - * @param prefab * @return A new entity, based on the given prefab */ EntityRef create(Prefab prefab); @@ -90,24 +87,17 @@ public interface EntityPool { // TODO: Review. Probably better to move these into a static helper /** - * @param prefab - * @param position * @return A new entity, based on the given prefab, at the desired position */ EntityRef create(String prefab, Vector3f position); /** - * @param prefab - * @param position * @return A new entity, based on the given prefab, at the desired position */ EntityRef create(Prefab prefab, Vector3f position); /** - * @param prefab - * @param position - * @param rotation - * @return + * @return A new entity, based on the given prefab, at the desired position, and with the desired rotation */ EntityRef create(Prefab prefab, Vector3f position, Quat4f rotation); @@ -116,7 +106,6 @@ public interface EntityPool { *

* This is used by the block entity system to give an illusion of permanence to temporary block entities. * - * @param components * @return The newly created entity ref. */ EntityRef createEntityWithoutLifecycleEvents(Iterable components); @@ -126,7 +115,6 @@ public interface EntityPool { *

* This is used by the block entity system to give an illusion of permanence to temporary block entities. * - * @param prefab * @return The newly created entity ref. */ EntityRef createEntityWithoutLifecycleEvents(String prefab); @@ -137,8 +125,6 @@ public interface EntityPool { * Allows the creation of an entity with a given id - this is used * when loading persisted entities * - * @param id - * @param components * @return The entityRef for the newly created entity */ EntityRef createEntityWithId(long id, Iterable components); @@ -146,21 +132,21 @@ public interface EntityPool { /** * Retrieve the entity ref with the given id. * - * @param id * @return the {@link EntityRef}, if it exists; {@link EntityRef#NULL} otherwise */ EntityRef getEntity(long id); + /** + * @return an iterable over all of the entities in this pool + */ Iterable getAllEntities(); /** - * @param componentClasses * @return An iterable over all entities with the provided component types. */ Iterable getEntitiesWith(Class... componentClasses); /** - * @param componentClasses * @return A count of entities with the provided component types */ int getCountOfEntitiesWith(Class... componentClasses); diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/EntityRef.java b/engine/src/main/java/org/terasology/entitySystem/entity/EntityRef.java index 4201ee140b8..ed1b35a25db 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/EntityRef.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/EntityRef.java @@ -96,7 +96,7 @@ public abstract class EntityRef implements MutableComponentContainer { /** * Sets the scope of the entity * - * @param scope + * @param scope the new scope for the entity */ public void setScope(EntityScope scope) { } diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/LowLevelEntityManager.java b/engine/src/main/java/org/terasology/entitySystem/entity/LowLevelEntityManager.java index 785ec2c8f6b..da519f5e11f 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/LowLevelEntityManager.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/LowLevelEntityManager.java @@ -19,8 +19,6 @@ import org.terasology.entitySystem.entity.internal.EngineEntityPool; import org.terasology.entitySystem.entity.internal.EngineSectorManager; -/** - */ public interface LowLevelEntityManager extends EntityManager { boolean isExistingEntity(long id); diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/SectorManager.java b/engine/src/main/java/org/terasology/entitySystem/entity/SectorManager.java index b403e82ba2b..5db54c84934 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/SectorManager.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/SectorManager.java @@ -15,7 +15,5 @@ */ package org.terasology.entitySystem.entity; -/** - */ public interface SectorManager extends EntityPool { } diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityManager.java b/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityManager.java index 5906db19373..42f892412f6 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityManager.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityManager.java @@ -23,8 +23,6 @@ import java.util.Optional; -/** - */ public interface EngineEntityManager extends LowLevelEntityManager, EngineEntityPool { void setEntityRefStrategy(RefStrategy strategy); diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityPool.java b/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityPool.java index c96789f900b..76e69aafc5b 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityPool.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineEntityPool.java @@ -22,8 +22,6 @@ import java.util.Optional; -/** - */ public interface EngineEntityPool extends EntityPool { /** diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineSectorManager.java b/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineSectorManager.java index 899f80f6993..866bdb086cb 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineSectorManager.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/internal/EngineSectorManager.java @@ -17,7 +17,5 @@ import org.terasology.entitySystem.entity.SectorManager; -/** - */ public interface EngineSectorManager extends SectorManager, EngineEntityPool { } diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityManager.java b/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityManager.java index 3f4dd148bbc..660a093e6bd 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityManager.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityManager.java @@ -54,8 +54,6 @@ import static org.terasology.entitySystem.entity.internal.EntityScope.SECTOR; -/** - */ public class PojoEntityManager implements EngineEntityManager { public static final long NULL_ID = 0; @@ -136,7 +134,6 @@ public EntityRef createSectorEntity(long maxDelta) { entity.addOrSaveComponent(new SectorSimulationComponent(maxDelta)); //TODO: look into keeping all sector entities loaded, or converting alwaysRelevant into another scope - entity.setAlwaysRelevant(true); return entity; } diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityPool.java b/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityPool.java index 3cf45f88abb..2e918d36c4a 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityPool.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoEntityPool.java @@ -40,8 +40,6 @@ import static org.terasology.entitySystem.entity.internal.PojoEntityManager.NULL_ID; -/** - */ public class PojoEntityPool implements EngineEntityPool { private PojoEntityManager entityManager; @@ -94,7 +92,8 @@ public EntityRef create(Iterable components, boolean sendLifecycleEve } } - for (Component component: components) { + //Retrieve the components again in case they were modified by the previous events + for (Component component : entityManager.iterateComponents(entity.getId())) { entityManager.notifyComponentAdded(entity, component.getClass()); } @@ -126,7 +125,6 @@ public EntityRef create(Prefab prefab, Vector3f position, Quat4f rotation) { return create(prefab, position, rotation, true); } - //@Override private EntityRef create(Prefab prefab, Vector3f position, Quat4f rotation, boolean sendLifecycleEvents) { EntityBuilder builder = newBuilder(prefab); builder.setSendLifecycleEvents(sendLifecycleEvents); @@ -147,8 +145,7 @@ private EntityRef create(Prefab prefab, Vector3f position, Quat4f rotation, bool return builder.build(); } - //@Override - public EntityRef create(String prefabName, Vector3f position, Quat4f rotation) { + private EntityRef create(String prefabName, Vector3f position, Quat4f rotation) { return create(prefabName, position, rotation, true); } @@ -170,7 +167,7 @@ private EntityRef create(String prefabName, Vector3f position, Quat4f rotation, /** * Destroys this entity, sending event * - * @param entityId + * @param entityId the id of the entity to destroy */ @Override public void destroy(long entityId) { @@ -288,6 +285,7 @@ public EntityRef createEntityWithId(long id, Iterable components) { return entity; } + @Override public EntityBuilder newBuilder() { return new EntityBuilder(entityManager, this); } diff --git a/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoSectorManager.java b/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoSectorManager.java index 21aea90d1ae..b06e58aba3b 100644 --- a/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoSectorManager.java +++ b/engine/src/main/java/org/terasology/entitySystem/entity/internal/PojoSectorManager.java @@ -28,8 +28,6 @@ import java.util.List; import java.util.Optional; -/** - */ public class PojoSectorManager implements EngineSectorManager { private List pools; diff --git a/engine/src/main/java/org/terasology/entitySystem/sectors/SectorSimulationEvent.java b/engine/src/main/java/org/terasology/entitySystem/sectors/SectorSimulationEvent.java index f7431c05ea2..4639c752303 100644 --- a/engine/src/main/java/org/terasology/entitySystem/sectors/SectorSimulationEvent.java +++ b/engine/src/main/java/org/terasology/entitySystem/sectors/SectorSimulationEvent.java @@ -43,7 +43,7 @@ protected SectorSimulationEvent(float delta) { * big variations in the time between sending these events (notably, an event will be sent whenever the chunk an * entity is in is loaded, even if one has just been sent. * - * Using the delta will give a relaible measure of how much simulation to perform. + * Using the delta will give a reliable measure of how much simulation to perform. * * @return the time, in seconds, since the last time this event was sent to the given entity */