Search in sources :

Example 6 with PojoEntityManager

use of org.terasology.entitySystem.entity.internal.PojoEntityManager in project Terasology by MovingBlocks.

the class IterateSingleComponentBenchmark method setup.

@Override
public void setup() {
    FastRandom rand = new FastRandom(0L);
    rawEntityData = Lists.newArrayList();
    for (int i = 0; i < 1000; ++i) {
        List<Component> entityData = Lists.newArrayList();
        if (rand.nextFloat() < 0.75f) {
            entityData.add(new LocationComponent());
        }
        if (rand.nextFloat() < 0.5f) {
            entityData.add(new MeshComponent());
        }
        if (rand.nextFloat() < 0.25f) {
            entityData.add(new BlockComponent());
        }
        rawEntityData.add(entityData);
    }
    entityManager = new PojoEntityManager();
    for (List<Component> rawEntity : rawEntityData) {
        entityManager.create(rawEntity);
    }
}
Also used : BlockComponent(org.terasology.world.block.BlockComponent) MeshComponent(org.terasology.rendering.logic.MeshComponent) PojoEntityManager(org.terasology.entitySystem.entity.internal.PojoEntityManager) FastRandom(org.terasology.utilities.random.FastRandom) MeshComponent(org.terasology.rendering.logic.MeshComponent) BlockComponent(org.terasology.world.block.BlockComponent) Component(org.terasology.entitySystem.Component) LocationComponent(org.terasology.logic.location.LocationComponent) LocationComponent(org.terasology.logic.location.LocationComponent)

Aggregations

PojoEntityManager (org.terasology.entitySystem.entity.internal.PojoEntityManager)6 TypeSerializationLibrary (org.terasology.persistence.typeHandling.TypeSerializationLibrary)3 Component (org.terasology.entitySystem.Component)2 EventSystemImpl (org.terasology.entitySystem.event.internal.EventSystemImpl)2 EntitySystemLibrary (org.terasology.entitySystem.metadata.EntitySystemLibrary)2 PojoPrefabManager (org.terasology.entitySystem.prefab.internal.PojoPrefabManager)2 LocationComponent (org.terasology.logic.location.LocationComponent)2 NetworkSystem (org.terasology.network.NetworkSystem)2 MeshComponent (org.terasology.rendering.logic.MeshComponent)2 FastRandom (org.terasology.utilities.random.FastRandom)2 BlockComponent (org.terasology.world.block.BlockComponent)2 Before (org.junit.Before)1 ContextImpl (org.terasology.context.internal.ContextImpl)1 ModuleManager (org.terasology.engine.module.ModuleManager)1 EventSystem (org.terasology.entitySystem.event.internal.EventSystem)1 PrefabManager (org.terasology.entitySystem.prefab.PrefabManager)1 ModuleEnvironment (org.terasology.module.ModuleEnvironment)1 EntityRefTypeHandler (org.terasology.persistence.typeHandling.extensionTypes.EntityRefTypeHandler)1 CopyStrategyLibrary (org.terasology.reflection.copy.CopyStrategyLibrary)1 ReflectFactory (org.terasology.reflection.reflect.ReflectFactory)1