diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index cd460a7f6f..baadfe9b54 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -470,7 +470,10 @@ public class ForgeChunkManager return; } - dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).build()); + if (dormantChunkCacheSize != 0) + { // only put into cache if we're using dormant chunk caching + dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).build()); + } WorldServer worldServer = (WorldServer) world; File chunkDir = worldServer.getChunkSaveLocation(); File chunkLoaderData = new File(chunkDir, "forcedchunks.dat"); @@ -615,7 +618,10 @@ public class ForgeChunkManager } forcedChunks.remove(world); - dormantChunkCache.remove(world); + if (dormantChunkCacheSize != 0) // only if in use + { + dormantChunkCache.remove(world); + } // integrated server is shutting down if (!FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning()) { @@ -961,6 +967,7 @@ public class ForgeChunkManager public static void putDormantChunk(long coords, Chunk chunk) { + if (dormantChunkCacheSize == 0) return; // Skip if we're not dormant caching chunks Cache cache = dormantChunkCache.get(chunk.getWorld()); if (cache != null) { @@ -971,6 +978,7 @@ public class ForgeChunkManager @Nullable public static Chunk fetchDormantChunk(long coords, World world) { + if (dormantChunkCacheSize == 0) return null; // Don't bother with maps at all if its never gonna get a response Cache cache = dormantChunkCache.get(world); if (cache == null) {