Use setChunkForceLoaded to keep needed chunks loaded

This commit is contained in:
Sutton Hathorn 2019-05-22 17:16:19 -04:00
parent 3b5370a18c
commit ecaed8578e
1 changed files with 5 additions and 0 deletions

View File

@ -234,7 +234,10 @@ public class WorldFillTask implements Runnable
if (worldData.doesChunkExist(dependency.forX, dependency.forZ)) if (worldData.doesChunkExist(dependency.forX, dependency.forZ))
chunksToUnload.add(new CoordXZ(dependency.neededX, dependency.neededZ)); chunksToUnload.add(new CoordXZ(dependency.neededX, dependency.neededZ));
else else
{
world.setChunkForceLoaded(dependency.neededX, dependency.neededZ, true);
newPreventUnload.add(dependency); newPreventUnload.add(dependency);
}
} }
preventUnload = newPreventUnload; preventUnload = newPreventUnload;
@ -247,6 +250,7 @@ public class WorldFillTask implements Runnable
for (CoordXZ unload: chunksToUnload) for (CoordXZ unload: chunksToUnload)
{ {
if (!chunkOnUnloadPreventionList(unload.x, unload.z)) if (!chunkOnUnloadPreventionList(unload.x, unload.z))
world.setChunkForceLoaded(unload.x, unload.z, false);
world.unloadChunkRequest(unload.x, unload.z); world.unloadChunkRequest(unload.x, unload.z);
} }
@ -443,6 +447,7 @@ public class WorldFillTask implements Runnable
preventUnload = null; preventUnload = null;
for (UnloadDependency entry: tempPreventUnload) for (UnloadDependency entry: tempPreventUnload)
{ {
world.setChunkForceLoaded(entry.neededX, entry.neededZ, false);
world.unloadChunkRequest(entry.neededX, entry.neededZ); world.unloadChunkRequest(entry.neededX, entry.neededZ);
} }
} }