ScannerLib
A cross-loader annotation scanning library for Minecraft 1.21.1 (NeoForge + Fabric).
ScannerLib discovers annotations from all loaded mods and exposes a loader-neutral index. It does not add items, blocks, registries, or datagen content.
This is a library mod. It adds no gameplay content. Install it only if another mod requires it.
Features
- Scan once and share the index globally
- Declarative scanning with
@ScanAnnotations - Identical query API on NeoForge and Fabric
- Raw annotation values plus resolved defaults
- Source mod id on every hit
- TYPE, FIELD, METHOD, and CONSTRUCTOR targets
- Optional
include/excludeclass-name filters
Compatibility
- Minecraft: 1.21.1
- NeoForge: 21.1.0+
- Fabric Loader: 0.15.11+
- Java: 21+
Installation
- NeoForge: put
scannerlib-neoforge-1.1.0.jarinmods/ - Fabric: put
scannerlib-fabric-1.1.0.jarinmods/ - Do not put
scannerlib-api-1.1.0.jarinmods/; it is a compile-only developer artifact.
For developers
@ScanAnnotations(MyEntry.class)
public final class MyScanConfig {
private MyScanConfig() {
}
}
AnnotationIndex index = AnnotationScan.index();
for (AnnotationHit hit : index.find(MyEntry.class, ElementType.FIELD)) {
MyEntry entry = hit.readAnnotation(MyEntry.class);
}
Links
- Source: https://github.com/Vanil1a-Chocolate/ScannerLib
- Issues: https://github.com/Vanil1a-Chocolate/ScannerLib/issues
中文说明
ScannerLib 是一个跨加载器注解扫描库,面向模组开发者。它扫描所有已加载模组中的注解并提供全局索引,本身不添加物品、方块或玩法内容。
这是库模组,只有其他模组要求时才需要安装。scannerlib-api 仅用于开发编译,不要放入 mods/。