use of org.terasology.engine.logic.characters.events.CreateVisualCharacterEvent in project Terasology by MovingBlocks.
the class VisualCharacterSystem method createVisualCharacterIfNotOwnCharacter.
void createVisualCharacterIfNotOwnCharacter(EntityRef characterEntity, VisualCharacterComponent visualCharacterComponent) {
boolean isCharacterOfLocalPlayer = characterEntity.getOwner().equals(localPlayer.getClientEntity());
if (isCharacterOfLocalPlayer) {
return;
}
CreateVisualCharacterEvent event = new CreateVisualCharacterEvent(entityManager.newBuilder());
characterEntity.send(event);
EntityBuilder entityBuilder = event.getVisualCharacterBuilder();
EntityRef visualCharacterEntity = createAndAttachVisualEntityStrategy.createAndAttachVisualEntity(entityBuilder, characterEntity);
visualCharacterComponent.visualCharacter = visualCharacterEntity;
characterEntity.saveComponent(visualCharacterComponent);
}
Aggregations