WorldRendererLwjgl.onChunkUnload()

manu3d

Active Member
Contributor
Architecture
Something picked my attention while looking at this code:

@Override
public void onChunkUnloaded(Vector3i pos) {
if (renderRegion.encompasses(pos)) {
Iterator<RenderableChunk> iterator = chunksInProximity.iterator();
while (iterator.hasNext()) {
RenderableChunk chunk = iterator.next();
if (chunk.getPosition().equals(pos)) {
chunk.disposeMesh();
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?
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps

manu3d

Active Member
Contributor
Architecture
Thanks Cerv. Sorry about spamming the forum with three threads on broadly related topics. I didn't realize it's a bad thing. I wish there was a way to delete a thread that I started. I'd be able to do a bit of cleanup!

Yes, I did notice the PR but I didn't notice that it directly affects one of the files I'm working on. Will keep an eye on it.

@Marcin Sciesinski ?
 
Top