Move timer out of mixin to fix crash.
This commit is contained in:
+10
@@ -110,6 +110,16 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
return this.dhLevel != null;
|
return this.dhLevel != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final java.util.Timer CLIENT_CLEANUP_TIMER = com.seibel.distanthorizons.core.util.TimerUtil.CreateTimer("ClientLevelTickCleanup");
|
||||||
|
|
||||||
|
private static final java.util.TimerTask CLIENT_CLEANUP_TASK = com.seibel.distanthorizons.core.util.TimerUtil.createTimerTask(() -> com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper.tickCleanup());
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
// 20 ticks per second (50ms interval)
|
||||||
|
CLIENT_CLEANUP_TIMER.scheduleAtFixedRate(CLIENT_CLEANUP_TASK, 0, 1000 / 20);
|
||||||
|
}
|
||||||
|
|
||||||
public static void tickCleanup()
|
public static void tickCleanup()
|
||||||
{
|
{
|
||||||
if (MINECRAFT.level == null) { return; }
|
if (MINECRAFT.level == null) { return; }
|
||||||
|
|||||||
-17
@@ -99,24 +99,7 @@ public abstract class MixinMinecraft
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Level load/unload is handled via renderer-driven loading for Immersive Portals
|
|
||||||
// and via render hooks in MixinLevelRenderer. Avoid duplicating level
|
|
||||||
// load/unload logic here to keep a single, consistent system.
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "close()V")
|
@Inject(at = @At("HEAD"), method = "close()V")
|
||||||
public void close(CallbackInfo ci) { SelfUpdater.onClose(); }
|
public void close(CallbackInfo ci) { SelfUpdater.onClose(); }
|
||||||
|
|
||||||
// Use a dedicated timer for cleanup instead of MC tick events
|
|
||||||
@Unique
|
|
||||||
private static final java.util.Timer CLIENT_CLEANUP_TIMER = com.seibel.distanthorizons.core.util.TimerUtil.CreateTimer("ClientLevelTickCleanup");
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
private static final java.util.TimerTask CLIENT_CLEANUP_TASK = com.seibel.distanthorizons.core.util.TimerUtil.createTimerTask(() -> com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper.tickCleanup());
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
// 20 ticks per second (50ms interval)
|
|
||||||
CLIENT_CLEANUP_TIMER.scheduleAtFixedRate(CLIENT_CLEANUP_TASK, 0, 1000 / 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user