From 297a8dc980f7c41f4f2ab607e567f135ea993009 Mon Sep 17 00:00:00 2001 From: Acuadragon100 <8165958-acuadragon100@users.noreply.gitlab.com> Date: Sun, 3 May 2026 19:38:56 +0200 Subject: [PATCH] Fix current level unloading on the client. --- .../common/wrappers/world/ClientLevelWrapper.java | 9 ++++----- coreSubProjects | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java index fe7b5cb3f..4a8602412 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java @@ -112,11 +112,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper private void unload() { AbstractDhWorld world = SharedApi.getAbstractDhWorld(); - if (world != null) - { - world.unloadLevel(this); - } - else + if (world == null || !world.unloadLevel(this)) { this.onUnload(); } @@ -132,6 +128,8 @@ public class ClientLevelWrapper implements IClientLevelWrapper long currentTime = System.currentTimeMillis(); long timeout = 30 * 1000; + System.out.println("Current: " + LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL); + ArrayList toUnload = new ArrayList<>(); synchronized(LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL) { @@ -141,6 +139,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper if (wrapper != null && wrapper.level != MINECRAFT.level) { + System.out.println("Thinking of unloading: " + wrapper + " Time: " + (currentTime - wrapper.getLastAccessTime())); // We use the synchronized getter to prevent race conditions with markAccessed() if (currentTime - wrapper.getLastAccessTime() > timeout) { diff --git a/coreSubProjects b/coreSubProjects index 5cb30ed7c..cc2febcb5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 5cb30ed7ceb649ab4d9b765de79b3e04930955e4 +Subproject commit cc2febcb5cc983867ac7e0d68d21a46cf6fe9f11