From c1a42e88604a42b2b6deb8653f32455ec07cc2d7 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Mon, 16 Mar 2026 21:42:53 +0100 Subject: [PATCH] Fix ChunkHider21 --- .../src/de/steamwar/techhider/ChunkHider21.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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);