From cacd2096ecd2fd6f6d67bf128d6e1dbcd1e8cec7 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 23 Aug 2018 13:42:45 -0700 Subject: [PATCH] save regularly --- src/main/java/baritone/chunk/CachedWorld.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/baritone/chunk/CachedWorld.java b/src/main/java/baritone/chunk/CachedWorld.java index a2a2fd6e..7c86db0f 100644 --- a/src/main/java/baritone/chunk/CachedWorld.java +++ b/src/main/java/baritone/chunk/CachedWorld.java @@ -66,6 +66,21 @@ public final class CachedWorld implements IBlockTypeAccess { // Insert an invalid region element cachedRegions.put(0, null); new PackerThread().start(); + new Thread() { + public void run() { + try { + 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 + // we'll only have a couple regions to save + save(); + Thread.sleep(600000); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }.start(); } public final void queueForPacking(Chunk chunk) {