Thread counts synced

This commit is contained in:
Daniel Mills
2021-07-20 11:19:47 -04:00
parent f4b41a43cf
commit 326bddad2a
17 changed files with 55 additions and 61 deletions

View File

@@ -25,6 +25,7 @@ import com.volmit.iris.engine.hunk.io.HunkRegion;
import com.volmit.iris.engine.hunk.io.HunkRegionSlice;
import com.volmit.iris.engine.object.tile.TileData;
import com.volmit.iris.engine.parallel.GridLock;
import com.volmit.iris.engine.parallel.MultiBurst;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.math.M;
@@ -50,16 +51,19 @@ public class ParallaxRegion extends HunkRegion {
private final GridLock lock;
private long lastUse;
private final int height;
private final MultiBurst burst;
public ParallaxRegion(int height, File folder, int x, int z, CompoundTag compound) {
public ParallaxRegion(MultiBurst burst, int height, File folder, int x, int z, CompoundTag compound) {
super(folder, x, z, compound);
this.burst = burst;
this.height = height;
setupSlices();
lock = new GridLock(32, 32);
}
public ParallaxRegion(int height, File folder, int x, int z) {
public ParallaxRegion(MultiBurst burst, int height, File folder, int x, int z) {
super(folder, x, z);
this.burst = burst;
this.height = height;
setupSlices();
lock = new GridLock(32, 32);
@@ -155,12 +159,13 @@ public class ParallaxRegion extends HunkRegion {
}
}
@Override
public synchronized void save() throws IOException {
blockSlice.save();
objectSlice.save();
entitySlice.save();
tileSlice.save();
updateSlice.save();
blockSlice.save(burst);
objectSlice.save(burst);
entitySlice.save(burst);
tileSlice.save(burst);
updateSlice.save(burst);
saveMetaHunk();
Iris.debug("Saved Parallax Region "+ C.GOLD + getX() + " " + getZ());
super.save();

View File

@@ -40,10 +40,12 @@ public class ParallaxWorld implements ParallaxAccess {
private final KMap<Long, ParallaxRegion> loadedRegions;
private final KList<Long> save;
private final File folder;
private final MultiBurst burst;
private final int height;
public ParallaxWorld(int height, File folder) {
public ParallaxWorld(MultiBurst burst, int height, File folder) {
this.height = height;
this.burst = burst;
this.folder = folder;
save = new KList<>();
loadedRegions = new KMap<>();
@@ -125,7 +127,7 @@ public class ParallaxWorld implements ParallaxAccess {
return loadedRegions.get(key(x, z));
}
ParallaxRegion v = new ParallaxRegion(height, folder, x, z);
ParallaxRegion v = new ParallaxRegion(burst, height, folder, x, z);
loadedRegions.put(key(x, z), v);
return v;