Examples of iterateComponents()


Examples of org.terasology.entitySystem.entity.EntityBuilder.iterateComponents()

        } else {
            target = entityManager.newBuilder();
        }
        deserializeOnto(target, entityData);
        if (entityData.hasId()) {
            return entityManager.createEntityWithId(entityData.getId(), target.iterateComponents());
        } else {
            return target.build();
        }
    }
View Full Code Here

Examples of org.terasology.entitySystem.entity.EntityBuilder.iterateComponents()

        BlockComponent blockComponent = blockEntity.getComponent(BlockComponent.class);

        Prefab oldPrefab = Assets.getPrefab(oldType.getPrefab());
        EntityBuilder oldEntityBuilder = entityManager.newBuilder(oldPrefab);
        oldEntityBuilder.addComponent(new BlockComponent(oldType, new Vector3i(blockComponent.getPosition())));
        BeforeEntityCreated oldEntityEvent = new BeforeEntityCreated(oldPrefab, oldEntityBuilder.iterateComponents());
        blockEntity.send(oldEntityEvent);
        for (Component comp : oldEntityEvent.getResultComponents()) {
            oldEntityBuilder.addComponent(comp);
        }
View Full Code Here

Examples of org.terasology.entitySystem.entity.EntityBuilder.iterateComponents()

        }

        Prefab newPrefab = Assets.getPrefab(type.getPrefab());
        EntityBuilder newEntityBuilder = entityManager.newBuilder(newPrefab);
        newEntityBuilder.addComponent(new BlockComponent(type, new Vector3i(blockComponent.getPosition())));
        BeforeEntityCreated newEntityEvent = new BeforeEntityCreated(newPrefab, newEntityBuilder.iterateComponents());
        blockEntity.send(newEntityEvent);
        for (Component comp : newEntityEvent.getResultComponents()) {
            newEntityBuilder.addComponent(comp);
        }
View Full Code Here

Examples of org.terasology.entitySystem.entity.EntityBuilder.iterateComponents()

            health.maxHealth = type.getHardness();
            health.currentHealth = Math.min(health.currentHealth, health.maxHealth);
            blockEntity.saveComponent(health);
        }

        for (Component comp : newEntityBuilder.iterateComponents()) {
            copyIntoPrefab(blockEntity, comp, retainComponents);
        }


    }
View Full Code Here

Examples of org.terasology.entitySystem.entity.EntityRef.iterateComponents()

                }
                selectedInterpreter = value;
                if (selectedInterpreter != null) {
                    EntityRef minion = value.actor().minion();
                    entityProperties.clear();
                    for (Component component : minion.iterateComponents()) {
                        entityProperties.addPropertyProvider(component.getClass().getSimpleName().replace("Component", ""), new PropertyProvider<>(component));
                    }
                }
                updateDebugger();
            }
View Full Code Here

Examples of org.terasology.entitySystem.entity.EntityRef.iterateComponents()

        itemComp.maxStackSize = (byte) stackSize;
        itemComp.stackId = stackId;
        EntityRef item = Mockito.mock(EntityRef.class);
        Mockito.when(item.exists()).thenReturn(true);
        Mockito.when(item.getComponent(ItemComponent.class)).thenReturn(itemComp);
        Mockito.when(item.iterateComponents()).thenReturn(new LinkedList<Component>());
        return item;
    }

    @Test
    public void testMoveItemToSlotsWithSplittingToMultipleStacks() {
View Full Code Here

Examples of org.terasology.entitySystem.prefab.Prefab.iterateComponents()

        }

        Map<Class<? extends Component>, Component> componentMap = Maps.newHashMap();
        if (entityData.hasParentPrefab() && !entityData.getParentPrefab().isEmpty() && prefabManager.exists(entityData.getParentPrefab())) {
            Prefab prefab = prefabManager.getPrefab(entityData.getParentPrefab());
            for (Component component : prefab.iterateComponents()) {
                ComponentMetadata<?> metadata = componentLibrary.getMetadata(component);
                if (!removedComponents.contains(metadata)) {
                    componentMap.put(component.getClass(), componentLibrary.copy(component));
                }
            }
View Full Code Here

Examples of org.terasology.entitySystem.prefab.Prefab.iterateComponents()

            }
        }
        entity.removeComponent(NetworkComponent.class);

        if (prefab != null) {
            for (Component comp : prefab.iterateComponents()) {
                Component currentComp = entity.getComponent(comp.getClass());
                if (currentComp == null) {
                    entity.addComponent(entityManager.getComponentLibrary().copy(comp));
                } else {
                    ComponentMetadata<?> metadata = entityManager.getComponentLibrary().getMetadata(comp.getClass());
View Full Code Here

Examples of org.terasology.entitySystem.prefab.Prefab.iterateComponents()

        EntityBuilder builder = entityManager.newBuilder(blockTypePrefab);
        builder.getComponent(BlockTypeComponent.class).block = block;
        // TODO: Copy across settings as necessary
        Prefab prefab = (!block.getPrefab().isEmpty()) ? prefabManager.getPrefab(block.getPrefab()) : null;
        if (prefab != null) {
            for (Component comp : prefab.iterateComponents()) {
                if (!(comp instanceof NetworkComponent)) {
                    builder.addComponent(entityManager.getComponentLibrary().copy(comp));
                }
            }
        }
View Full Code Here

Examples of org.terasology.entitySystem.prefab.Prefab.iterateComponents()

        String prefab = block.getPrefab();
        boolean keepActive = block.isKeepActive();
        boolean requiresLifecycleEvents = false;
        if (!prefab.isEmpty()) {
            Prefab blockPrefab = prefabManager.getPrefab(prefab);
            for (Component comp : blockPrefab.iterateComponents()) {
                ComponentMetadata<?> metadata = entityManager.getComponentLibrary().getMetadata(comp.getClass());
                if (metadata.isForceBlockActive()) {
                    keepActive = true;
                    break;
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.