- glm::vec3 diff(glm::vec3(chunk * Chunk::Extent() - pos) + world.Player().Position());
- float dist = dot(diff, diff);
- if (dist > despawn_range || dist < spawn_distance) {
+ //glm::vec3 diff(glm::vec3(chunk * Chunk::Extent() - pos) + player.entity->Position());
+ //float dist = dot(diff, diff);
+ //if (dist > despawn_range || dist < spawn_distance) {
+ // return;
+ //}
+
+ // check if the spawn block and the one above it are loaded and inhabitable
+ BlockLookup spawn_block((*player.chunks)[index], pos);
+ if (!spawn_block || spawn_block.GetType().collide_block) {