diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/techhider/ChunkHider21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/techhider/ChunkHider21.java index 1cc6c29c..3c665457 100644 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/techhider/ChunkHider21.java +++ b/SpigotCore/SpigotCore_21/src/de/steamwar/techhider/ChunkHider21.java @@ -90,7 +90,15 @@ public class ChunkHider21 implements ChunkHider { public static final Class tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo"); protected static final Reflection.Field entityType = Reflection.getField(tileEntity, BlockEntityType.class, 0); private static final Class builtInRegestries = Reflection.getClass("net.minecraft.core.registries.BuiltInRegistries"); - private static final Class registry = Reflection.getClass("net.minecraft.core.Registry"); + private static final Class registry; + static { + // This is needed because `Class.forName("net.minecraft.core.Registry")` resolved to net.minecraft.core.IdMap instead of the needed class! + try { + registry = Reflection.class.getClassLoader().loadClass("net.minecraft.core.Registry"); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException("Cannot find net.minecraft.core.Registry", e); + } + } private static final Reflection.Field nameField = Reflection.getField(builtInRegestries, "BLOCK_ENTITY_TYPE", registry); private static final Class resourceLocation = Reflection.getClass("net.minecraft.resources.ResourceLocation"); private static final Reflection.Method getKey = Reflection.getTypedMethod(registry, "getKey", resourceLocation, Object.class);