mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 18:45:09 +00:00
Bypass forge chunk cache if it's configuratively disabled
This commit is contained in:
1 parent
b0ae0be80e
commit
9fe6385e1f
1 file changed
+10
-2
@@ -470,7 +470,10 @@ public class ForgeChunkManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).<Long, Chunk>build());
|
if (dormantChunkCacheSize != 0)
|
||||||
|
{ // only put into cache if we're using dormant chunk caching
|
||||||
|
dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).<Long, Chunk>build());
|
||||||
|
}
|
||||||
WorldServer worldServer = (WorldServer) world;
|
WorldServer worldServer = (WorldServer) world;
|
||||||
File chunkDir = worldServer.getChunkSaveLocation();
|
File chunkDir = worldServer.getChunkSaveLocation();
|
||||||
File chunkLoaderData = new File(chunkDir, "forcedchunks.dat");
|
File chunkLoaderData = new File(chunkDir, "forcedchunks.dat");
|
||||||
@@ -615,7 +618,10 @@ public class ForgeChunkManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
forcedChunks.remove(world);
|
forcedChunks.remove(world);
|
||||||
dormantChunkCache.remove(world);
|
if (dormantChunkCacheSize != 0) // only if in use
|
||||||
|
{
|
||||||
|
dormantChunkCache.remove(world);
|
||||||
|
}
|
||||||
// integrated server is shutting down
|
// integrated server is shutting down
|
||||||
if (!FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning())
|
if (!FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning())
|
||||||
{
|
{
|
||||||
@@ -959,6 +965,7 @@ public class ForgeChunkManager
|
|||||||
|
|
||||||
public static void putDormantChunk(long coords, Chunk chunk)
|
public static void putDormantChunk(long coords, Chunk chunk)
|
||||||
{
|
{
|
||||||
|
if (dormantChunkCacheSize == 0) return; // Skip if we're not dormant caching chunks
|
||||||
Cache<Long, Chunk> cache = dormantChunkCache.get(chunk.getWorld());
|
Cache<Long, Chunk> cache = dormantChunkCache.get(chunk.getWorld());
|
||||||
if (cache != null)
|
if (cache != null)
|
||||||
{
|
{
|
||||||
@@ -968,6 +975,7 @@ public class ForgeChunkManager
|
|||||||
|
|
||||||
public static Chunk fetchDormantChunk(long coords, World world)
|
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<Long, Chunk> cache = dormantChunkCache.get(world);
|
Cache<Long, Chunk> cache = dormantChunkCache.get(world);
|
||||||
if (cache == null)
|
if (cache == null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user