From e00e837237645a2d17387471a030051b17d3ddc3 Mon Sep 17 00:00:00 2001 From: mworzala Date: Mon, 5 Jun 2023 22:00:25 -0400 Subject: [PATCH] fix main minestom support --- .../net/hollowcube/polar/compat/ChunkSupplierShim.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/hollowcube/polar/compat/ChunkSupplierShim.java b/src/main/java/net/hollowcube/polar/compat/ChunkSupplierShim.java index cda4fa9..4fd951a 100644 --- a/src/main/java/net/hollowcube/polar/compat/ChunkSupplierShim.java +++ b/src/main/java/net/hollowcube/polar/compat/ChunkSupplierShim.java @@ -6,6 +6,9 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; + /** * A shim for {@link net.minestom.server.utils.chunk.ChunkSupplier} to allow for * compatibility with main Minestom which does not have the lighting PR (which @@ -17,10 +20,10 @@ public interface ChunkSupplierShim { static @NotNull ChunkSupplierShim select() { try { - // If this class is present we have the lighting branch and should use that chunk supplier - Class.forName("net.minestom.server.utils.chunk.ChunkSupplier"); + // If this function is present we have the lighting branch and should use that chunk supplier + Instance.class.getDeclaredMethod("getChunkSupplier"); return (instance, cx, cz) -> instance.getChunkSupplier().createChunk(instance, cx, cz); - } catch (ClassNotFoundException e) { + } catch (NoSuchMethodException e) { // Otherwise we should use the default chunk supplier return DynamicChunk::new; }