Something picked my attention while looking at this code:
@Override
public void onChunkUnloaded(Vector3i pos) {
Notice the line in bold. It seems to me that if one removes an item from the list chunksInProximity, there shouldn't be any need to re-sort the list front to back. Right?
@Override
public void onChunkUnloaded(Vector3i pos) {
if (renderRegion.encompasses(pos)) {
Iterator<RenderableChunk> iterator = chunksInProximity.iterator();
}Iterator<RenderableChunk> iterator = chunksInProximity.iterator();
while (iterator.hasNext()) {
}RenderableChunk chunk = iterator.next();
if (chunk.getPosition().equals(pos)) {
}if (chunk.getPosition().equals(pos)) {
chunk.disposeMesh();
iterator.remove();
Collections.sort(chunksInProximity, new ChunkFrontToBackComparator());
break;
}iterator.remove();
Collections.sort(chunksInProximity, new ChunkFrontToBackComparator());
break;
Notice the line in bold. It seems to me that if one removes an item from the list chunksInProximity, there shouldn't be any need to re-sort the list front to back. Right?