better chunk saving and loading
This commit is contained in:
parent
c0fb57825c
commit
c761a9b127
4
src/main/java/baritone/behavior/impl/MineBehavior.java
Normal file
4
src/main/java/baritone/behavior/impl/MineBehavior.java
Normal file
@ -0,0 +1,4 @@
|
||||
package baritone.behavior.impl;
|
||||
|
||||
public class MineBehavior {
|
||||
}
|
@ -117,8 +117,8 @@ public final class CachedRegion implements IBlockTypeAccess {
|
||||
Files.createFile(regionFile);
|
||||
try (
|
||||
FileOutputStream fileOut = new FileOutputStream(regionFile.toFile());
|
||||
GZIPOutputStream gzipOut = new GZIPOutputStream(fileOut);
|
||||
DataOutputStream out = new DataOutputStream(gzipOut);
|
||||
GZIPOutputStream gzipOut = new GZIPOutputStream(fileOut, 16384);
|
||||
DataOutputStream out = new DataOutputStream(gzipOut)
|
||||
) {
|
||||
out.writeInt(CACHED_REGION_MAGIC);
|
||||
for (int z = 0; z < 32; z++) {
|
||||
@ -183,8 +183,8 @@ public final class CachedRegion implements IBlockTypeAccess {
|
||||
|
||||
try (
|
||||
FileInputStream fileIn = new FileInputStream(regionFile.toFile());
|
||||
GZIPInputStream gzipIn = new GZIPInputStream(fileIn);
|
||||
DataInputStream in = new DataInputStream(gzipIn);
|
||||
GZIPInputStream gzipIn = new GZIPInputStream(fileIn, 32768);
|
||||
DataInputStream in = new DataInputStream(gzipIn)
|
||||
) {
|
||||
int magic = in.readInt();
|
||||
if (magic != CACHED_REGION_MAGIC) {
|
||||
|
@ -69,6 +69,7 @@ public final class CachedWorld implements IBlockTypeAccess {
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(30000);
|
||||
while (true) {
|
||||
// since a region only saves if it's been modified since its last save
|
||||
// saving every 10 minutes means that once it's time to exit
|
||||
@ -141,7 +142,7 @@ public final class CachedWorld implements IBlockTypeAccess {
|
||||
return;
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
this.cachedRegions.values().forEach(region -> {
|
||||
this.cachedRegions.values().parallelStream().forEach(region -> {
|
||||
if (region != null)
|
||||
region.save(this.directory);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user