From 4c984c5c102aaee9fd5a34acf94aa0ffbdbfacb1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 29 Mar 2022 20:48:59 -0500 Subject: [PATCH] Close #140 (no rendering if world named "No World Loaded" ) --- .../seibel/lod/core/objects/lod/LodWorld.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/objects/lod/LodWorld.java b/src/main/java/com/seibel/lod/core/objects/lod/LodWorld.java index e3528d462..2071ec7a0 100644 --- a/src/main/java/com/seibel/lod/core/objects/lod/LodWorld.java +++ b/src/main/java/com/seibel/lod/core/objects/lod/LodWorld.java @@ -27,10 +27,9 @@ import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper; /** * This stores all LODs for a given world. - * * @author James Seibel * @author Leonardo Amato - * @version 9-27-2021 + * @version 2022-3-29 */ public class LodWorld { @@ -44,7 +43,7 @@ public class LodWorld private boolean isWorldLoaded = false; /** the name given to the world if it isn't loaded */ - public static final String NO_WORLD_LOADED = "No world loaded"; + public static final String NO_WORLD_LOADED = ""; @@ -69,7 +68,7 @@ public class LodWorld // don't recreate everything if we // didn't actually change worlds return; - + deselectWorld(); worldName = newWorldName; lodDimensions = new Hashtable<>(); @@ -77,8 +76,7 @@ public class LodWorld } /** - * Set the worldName to "No world loaded" - * and clear the lodDimensions Map.
+ * Clear the lodDimensions Map.
* This should be done whenever unloaded a world.

*

* Note a System.gc() call may be in order after calling this
@@ -103,7 +101,8 @@ public class LodWorld return; LodDimension oldDim = lodDimensions.put(newDimension.dimension, newDimension); - if (oldDim != null) oldDim.saveDirtyRegionsToFile(true); + if (oldDim != null) + oldDim.saveDirtyRegionsToFile(true); } /** @@ -144,11 +143,13 @@ public class LodWorld // but that requires a LodDimension.hasDirtyRegions() method or something similar ApiShared.LOGGER.info("Saving LODs"); - for (IDimensionTypeWrapper key : lodDimensions.keySet()) { + for (IDimensionTypeWrapper key : lodDimensions.keySet()) + { lodDimensions.get(key).saveDirtyRegionsToFile(isBlocking); } //FIXME: This should block until file is saved. } + /** * Requests all dimensions to shutdown */ @@ -158,7 +159,8 @@ public class LodWorld return; // TODO: Add parallel shutdowns. - for (IDimensionTypeWrapper key : lodDimensions.keySet()) { + for (IDimensionTypeWrapper key : lodDimensions.keySet()) + { lodDimensions.get(key).shutdown(); } }