SizzLib
SizzLib is a specialized library designed for Minecraft mod developers. Its main purpose is to simplify the creation of client-side commands, functional features, and data persistence mechanisms that work exclusively on the client side.
Usage Benefits
Developers gain significant advantages when working with SizzLib. The library provides high iteration speed when creating new features, as well as offering a simple local data persistence system tied to specific game worlds. An important feature is that this system functions even when connected to vanilla servers.
Annotation System
The library uses Java's annotation system to designate methods and fields as command components or data for local persistence. For practical familiarity with ModComponentRegistry's operation, it's recommended to study the SizzLibClient and ExamplePersistable classes.
Data Management
The PersistenceManager class provides save(...) and load(...) functions that allow serializing and deserializing objects in JSON format with subsequent local storage.
Command System
The @Command annotation is applied at the class level and, when registered through ModComponentRegistry, creates a client-side command based on Brigadier.
The @CommandOption annotation is used for fields and creates subcommands allowing users to read or modify field values depending on the annotation parameter configuration. The system supports parsing enums with automatic suggestion creation from possible values, as well as working with Minecraft's proprietary types such as ItemStack and BlockPos.
The @CommandAction annotation is applied to methods and creates subcommands for their execution. Supported parameter types in the method signature are passed during execution.
Tick System
The library provides several annotations for convenient work with game cycles:
- @ClientTick executes the method at the end of each game tick
- @ScreenTick triggers at the end of each screen tick, with the ability to pass the Screen object as a parameter
- @ScreenInit executes during screen initialization, for example, every time a container is opened
These annotations automatically connect to the corresponding registration events, significantly simplifying the development process.