forked from SteamWar/SteamWar
Fix ChunkHider21
This commit is contained in:
@@ -90,7 +90,15 @@ public class ChunkHider21 implements ChunkHider {
|
|||||||
public static final Class<?> tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo");
|
public static final Class<?> tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo");
|
||||||
protected static final Reflection.Field<BlockEntityType> entityType = Reflection.getField(tileEntity, BlockEntityType.class, 0);
|
protected static final Reflection.Field<BlockEntityType> entityType = Reflection.getField(tileEntity, BlockEntityType.class, 0);
|
||||||
private static final Class<?> builtInRegestries = Reflection.getClass("net.minecraft.core.registries.BuiltInRegistries");
|
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 Reflection.Field<?> nameField = Reflection.getField(builtInRegestries, "BLOCK_ENTITY_TYPE", registry);
|
||||||
private static final Class<?> resourceLocation = Reflection.getClass("net.minecraft.resources.ResourceLocation");
|
private static final Class<?> resourceLocation = Reflection.getClass("net.minecraft.resources.ResourceLocation");
|
||||||
private static final Reflection.Method getKey = Reflection.getTypedMethod(registry, "getKey", resourceLocation, Object.class);
|
private static final Reflection.Method getKey = Reflection.getTypedMethod(registry, "getKey", resourceLocation, Object.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user