mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 16:36:00 +00:00
more headless speed
This commit is contained in:
parent
3bffe4cc7e
commit
b1e87afc93
@ -33,7 +33,7 @@ public class SyncChunkDataHunkHolder extends ArrayHunk<BlockData> {
|
||||
}
|
||||
|
||||
public void apply() {
|
||||
for (int i = 0; i < getHeight(); i++) {
|
||||
for (int i = getHeight()-1; i >= 0; i--) {
|
||||
for (int j = 0; j < getWidth(); j++) {
|
||||
for (int k = 0; k < getDepth(); k++) {
|
||||
BlockData b = super.getRaw(j, i, k);
|
||||
|
@ -45,14 +45,19 @@ public final class RegionFileStorage implements AutoCloseable {
|
||||
this.sync = sync;
|
||||
}
|
||||
|
||||
public synchronized RegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException {
|
||||
public RegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException {
|
||||
long id = ChunkPos.asLong(chunkPos.getRegionX(), chunkPos.getRegionZ());
|
||||
RegionFile regionFile = this.regionCache.getAndMoveToFirst(id);
|
||||
RegionFile regionFile;
|
||||
synchronized (this.regionCache) {
|
||||
regionFile = this.regionCache.getAndMoveToFirst(id);
|
||||
}
|
||||
if (regionFile != null) {
|
||||
return regionFile;
|
||||
} else {
|
||||
if (this.regionCache.size() >= 256) {
|
||||
this.regionCache.removeLast().close();
|
||||
synchronized (this.regionCache) {
|
||||
this.regionCache.removeLast().close();
|
||||
}
|
||||
}
|
||||
|
||||
FileUtil.createDirectoriesSafe(this.folder);
|
||||
@ -61,7 +66,9 @@ public final class RegionFileStorage implements AutoCloseable {
|
||||
return null;
|
||||
} else {
|
||||
regionFile = new RegionFile(path, this.folder, this.sync);
|
||||
this.regionCache.putAndMoveToFirst(id, regionFile);
|
||||
synchronized (this.regionCache) {
|
||||
this.regionCache.putAndMoveToFirst(id, regionFile);
|
||||
}
|
||||
return regionFile;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user