From d59c7cb7a8b0deaa28d516799345ce191834c809 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 5 Nov 2018 17:30:45 -0800 Subject: [PATCH] temporarily disable cached region ram pruning --- src/api/java/baritone/api/Settings.java | 9 ++++++++- src/main/java/baritone/cache/CachedWorld.java | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 0d8529dd..9cd69f95 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -24,8 +24,8 @@ import net.minecraft.util.text.ITextComponent; import java.awt.*; import java.lang.reflect.Field; -import java.util.List; import java.util.*; +import java.util.List; import java.util.function.Consumer; /** @@ -276,6 +276,13 @@ public class Settings { */ public Setting chunkCaching = new Setting<>(true); + /** + * On save, delete from RAM any cached regions that are more than 1024 blocks away from the player + *

+ * Temporarily disabled, see issue #248 + */ + public Setting pruneRegionsFromRAM = new Setting<>(false); + /** * Print all the debug messages to chat */ diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index 14b66839..a5641eea 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -165,6 +165,9 @@ public final class CachedWorld implements ICachedWorld, Helper { * Delete regions that are too far from the player */ private synchronized void prune() { + if (!Baritone.settings().pruneRegionsFromRAM.get()) { + return; + } BlockPos pruneCenter = guessPosition(); for (CachedRegion region : allRegions()) { if (region == null) {