Added null check for chunk
import org.terasology.rendering.world.viewDistance.ViewDistance;
import org.terasology.world.ChunkView;
import org.terasology.world.WorldProvider;
+import org.terasology.world.chunks.Chunk;
import org.terasology.world.chunks.ChunkConstants;
import org.terasology.world.chunks.ChunkProvider;
import org.terasology.world.chunks.RenderableChunk;
@Override
public void onChunkLoaded(Vector3i chunkCoordinates) {
if (renderableRegion.encompasses(chunkCoordinates)) {
- chunksInProximityOfCamera.add(chunkProvider.getChunk(chunkCoordinates));
+ Chunk chunk = chunkProvider.getChunk(chunkCoordinates);
+ if (chunk == null) {
+ logger.warn("Warning: onChunkLoaded called for a null chunk!");
+ } else {
+ chunksInProximityOfCamera.add(chunk);
Collections.sort(chunksInProximityOfCamera, new ChunkFrontToBackComparator());
}
}
+ }
@Override
public void onChunkUnloaded(Vector3i chunkCoordinates) {
