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);
}
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);
}
for (Component component : blockEntity.iterateComponents()) {
if (!COMMON_BLOCK_COMPONENTS.contains(component.getClass())