Optimize server thread aliveness check

This commit is contained in:
embeddedt 2023-05-09 16:52:10 -04:00
parent d70480eb17
commit 03abdfdc49
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -29,7 +29,7 @@ public abstract class ServerChunkCacheMixin {
@Inject(method = "getChunk", at = @At("HEAD"), cancellable = true)
private void bailIfServerDead(int chunkX, int chunkZ, ChunkStatus requiredStatus, boolean load, CallbackInfoReturnable<ChunkAccess> cir) {
if(!this.mainThread.isAlive()) {
if(!this.level.getServer().isRunning() && !this.mainThread.isAlive()) {
ModernFix.LOGGER.fatal("A mod is accessing chunks from a stopped server (this will also cause memory leaks)");
if(debugDeadServerAccess) {
new Exception().printStackTrace();