Overview
SSECLib is an annotation-driven command and event framework for Fabric mods.
Instead of building Brigadier trees by hand and registering Fabric event callbacks one by one, you:
- expose one or more
ssecentrypoints infabric.mod.json - implement
SSECInitializer - point the library at the packages that contain annotated classes
- let the scanner register command and event handlers
Startup flow
Section titled “Startup flow”SuperSexyEventCommandLib is the Fabric ModInitializer for the library.
At startup it:
- loads every
ssecentrypoint viaFabricLoader.getEntrypoints("ssec", SSECInitializer.class) - calls
onInitializeSSEC()on each initializer - collects the packages returned by
getPackagesToScan() - runs
SSECScanner.initialize()after every package has been registered
This is the main contract of the framework: your mod tells SSEC where the annotated classes are, and SSEC handles discovery and registration.
Main public surface
Section titled “Main public surface”The public API is intentionally small:
SSECInitializerfor entrypoint setup@SSCommand,@SSCExecute,@SSCArgument,@SSCAlias, and@SSCPermissionfor commands@SSEventfor Fabric event listenersSSCArgumentAdapterfor custom argument mappingPermissionLevelandSSCPermissionCheckerfor permission policies
When to use it
Section titled “When to use it”SSEC is useful when your mod has:
- multiple commands or subcommands
- repeatable permission rules
- a lot of command argument parsing
- several Fabric callbacks that you want to keep close to feature code
If your mod has only one small command and no reusable event layer, plain Brigadier and plain Fabric callbacks may still be simpler.