Package org.terasology.entitySystem.entity

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


        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

        }

        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

            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

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.