use of org.terasology.entitySystem.entity.EntityBuilder in project Terasology by MovingBlocks.
the class NetworkEntitySerializer method deserialize.
public EntityRef deserialize(EntityData.PackedEntity entityData) {
EntityBuilder target;
if (entityData.hasParentPrefabUri()) {
target = entityManager.newBuilder(entityData.getParentPrefabUri());
} else {
target = entityManager.newBuilder();
}
deserializeOnto(target, entityData);
if (entityData.hasId()) {
return entityManager.createEntityWithId(entityData.getId(), target.iterateComponents());
} else {
return target.build();
}
}
use of org.terasology.entitySystem.entity.EntityBuilder in project Terasology by MovingBlocks.
the class CameraClientSystem method ensureCameraEntityCreated.
private void ensureCameraEntityCreated() {
if (!localPlayer.getCameraEntity().exists()) {
ClientComponent clientComponent = localPlayer.getClientEntity().getComponent(ClientComponent.class);
// create the camera from the prefab
EntityBuilder builder = entityManager.newBuilder("engine:camera");
builder.setPersistent(false);
clientComponent.camera = builder.build();
localPlayer.getClientEntity().saveComponent(clientComponent);
}
}
use of org.terasology.entitySystem.entity.EntityBuilder in project Terasology by MovingBlocks.
the class FirstPersonClientSystem method getHandEntity.
private EntityRef getHandEntity() {
if (handEntity == null) {
// create the hand entity
EntityBuilder entityBuilder = entityManager.newBuilder("engine:hand");
entityBuilder.setPersistent(false);
handEntity = entityBuilder.build();
}
return handEntity;
}
use of org.terasology.entitySystem.entity.EntityBuilder in project Terasology by MovingBlocks.
the class PlayerFactory method findSpawnPositionFromLocationComponent.
public Vector3f findSpawnPositionFromLocationComponent(LocationComponent locationComponent) {
EntityBuilder builder = entityManager.newBuilder("engine:player");
// spawn a little bit above the ground
float extraSpace = 0.5f;
float entityHeight = getHeightOf(builder) + extraSpace;
// TODO: Handle Optional being empty
return findSpawnPos(locationComponent.getWorldPosition(), entityHeight).get();
}
use of org.terasology.entitySystem.entity.EntityBuilder in project Terasology by MovingBlocks.
the class GazeAuthoritySystem method createGazeEntity.
private EntityRef createGazeEntity() {
EntityBuilder gazeContainerBuilder = entityManager.newBuilder("engine:gaze");
EntityRef gazeEntity = gazeContainerBuilder.build();
return gazeEntity;
}
Aggregations