Parallax tweaks

This commit is contained in:
Daniel Mills 2020-10-31 08:30:28 -04:00
parent 6c8db56474
commit c7c1b2b8c1
3 changed files with 29 additions and 1 deletions

View File

@ -88,4 +88,8 @@ public interface ParallaxAccess
public void saveAll();
public void saveAllNOW();
public int getRegionCount();
public int getChunkCount();
}

View File

@ -173,4 +173,8 @@ public class ParallaxRegion extends HunkRegion
objectSlice.cleanup(c);
updateSlice.cleanup(c);
}
public int getChunkCount() {
return blockSlice.getLoadCount() + objectSlice.getLoadCount() + updateSlice.getLoadCount();
}
}

View File

@ -22,10 +22,30 @@ public class ParallaxWorld implements ParallaxAccess
this.folder = folder;
save = new KList<>();
loadedRegions = new KMap<>();
cleanup = new ChronoLatch(10000);
cleanup = new ChronoLatch(5000);
folder.mkdirs();
}
public int getRegionCount()
{
return loadedRegions.size();
}
public int getChunkCount()
{
int m = 0;
synchronized (loadedRegions)
{
for(ParallaxRegion i : loadedRegions.values())
{
m+= i.getChunkCount();
}
}
return m;
}
public synchronized void close()
{
for(ParallaxRegion i : loadedRegions.v())