Readd ignore chunk loads

This commit is contained in:
mastermc05 2022-03-31 15:04:36 +03:00
parent 3760549dda
commit 4d046fc4de
3 changed files with 67 additions and 60 deletions

View file

@ -2,8 +2,6 @@ package org.dynmap.bukkit.helper.v118_2;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.level.World;
import net.minecraft.world.level.chunk.Chunk;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -51,7 +49,8 @@ public class AsyncChunkProvider118_2 {
return future.thenApply((resultFuture) -> {
if (resultFuture == null) return null;
try {
return (NBTTagCompound) resultFuture.getClass().getField("chunkData").get(resultFuture);
NBTTagCompound compound = (NBTTagCompound) resultFuture.getClass().getField("chunkData").get(resultFuture);
return ifFailed.test(compound) ? null : compound;
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}

View file

@ -54,8 +54,8 @@ public class MapChunkCache118_2 extends GenericMapChunkCache {
};
} catch (InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
return () -> loadChunk(chunk);
}
return () -> null;
}
private Supplier<GenericChunk> getLoadedChunk(DynmapChunk chunk, boolean async) {