Fix current level unloading on the client.
This commit is contained in:
+4
-5
@@ -112,11 +112,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
private void unload()
|
private void unload()
|
||||||
{
|
{
|
||||||
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
|
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
|
||||||
if (world != null)
|
if (world == null || !world.unloadLevel(this))
|
||||||
{
|
|
||||||
world.unloadLevel(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
this.onUnload();
|
this.onUnload();
|
||||||
}
|
}
|
||||||
@@ -132,6 +128,8 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
long timeout = 30 * 1000;
|
long timeout = 30 * 1000;
|
||||||
|
|
||||||
|
System.out.println("Current: " + LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL);
|
||||||
|
|
||||||
ArrayList<ClientLevelWrapper> toUnload = new ArrayList<>();
|
ArrayList<ClientLevelWrapper> toUnload = new ArrayList<>();
|
||||||
synchronized(LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL)
|
synchronized(LEVEL_WRAPPER_REF_BY_CLIENT_LEVEL)
|
||||||
{
|
{
|
||||||
@@ -141,6 +139,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
if (wrapper != null
|
if (wrapper != null
|
||||||
&& wrapper.level != MINECRAFT.level)
|
&& 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()
|
// We use the synchronized getter to prevent race conditions with markAccessed()
|
||||||
if (currentTime - wrapper.getLastAccessTime() > timeout)
|
if (currentTime - wrapper.getLastAccessTime() > timeout)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
Submodule coreSubProjects updated: 5cb30ed7ce...cc2febcb5c
Reference in New Issue
Block a user