mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-13 19:26:26 +00:00
Auto stash before revert of "Drop it "
This commit is contained in:
@@ -18,12 +18,15 @@
|
||||
|
||||
package com.volmit.iris.util.nbt.mca;
|
||||
|
||||
import com.volmit.iris.core.pregenerator.syndicate.SyndicateServer;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@@ -37,6 +40,7 @@ public class MCAFile {
|
||||
private final int regionX;
|
||||
private final int regionZ;
|
||||
private AtomicReferenceArray<Chunk> chunks;
|
||||
private ConcurrentLinkedQueue<Runnable> afterSave;
|
||||
|
||||
/**
|
||||
* MCAFile represents a world save file used by Minecraft to store world
|
||||
@@ -50,6 +54,7 @@ public class MCAFile {
|
||||
public MCAFile(int regionX, int regionZ) {
|
||||
this.regionX = regionX;
|
||||
this.regionZ = regionZ;
|
||||
afterSave = new ConcurrentLinkedQueue<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,6 +203,11 @@ public class MCAFile {
|
||||
raf.seek(globalOffset * 4096L - 1);
|
||||
raf.write(0);
|
||||
}
|
||||
|
||||
J.a(() -> {
|
||||
afterSave.forEach(i -> i.run());
|
||||
}, 20);
|
||||
|
||||
return chunksWritten;
|
||||
}
|
||||
|
||||
@@ -326,4 +336,8 @@ public class MCAFile {
|
||||
}
|
||||
return chunk.getBlockStateAt(blockX, blockY, blockZ);
|
||||
}
|
||||
|
||||
public void afterSave(Runnable o) {
|
||||
afterSave.add(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,4 +329,8 @@ public class NBTWorld {
|
||||
public int size() {
|
||||
return loadedRegions.size();
|
||||
}
|
||||
|
||||
public boolean isLoaded(int x, int z) {
|
||||
return loadedRegions.containsKey(Cache.key(x, z));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user