diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 824dfd7e2..a8e4ced7d 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -622,6 +622,13 @@ public final class Settings { */ public final Setting pruneRegionsFromRAM = new Setting<>(true); + /** + * The chunk packer queue can never grow to larger than this, if it does, the oldest chunks are discarded + *

+ * The newest chunks are kept, so that if you're moving in a straight line quickly then stop, your immediate render distance is still included + */ + public final Setting chunkPackerQueueMaxSize = new Setting<>(2000); + /** * Fill in blocks behind you */ diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index 6b3959fe3..32112f20f 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -307,6 +307,9 @@ public final class CachedWorld implements ICachedWorld, Helper { try { ChunkPos pos = toPackQueue.take(); Chunk chunk = toPackMap.remove(pos); + if (toPackQueue.size() > Baritone.settings().chunkPackerQueueMaxSize.value) { + continue; + } CachedChunk cached = ChunkPacker.pack(chunk); CachedWorld.this.updateCachedChunk(cached); //System.out.println("Processed chunk at " + chunk.x + "," + chunk.z);