Set Up Class Transformers for Your Mod
Create the Transformer Configuration File
Class transformers allow you to modify bytecode of classes before they load into the JVM. Start by creating a JSON configuration file in your mod's resources directory (e.g., xxxx.classtransform.json).
Structure your file with a package field pointing to your transformer classes and a transformers array listing each transformer class name:
`json
{"package": "your.package.name.transformer","transformers": ["YourTransformerClass"]}
`
Register in Your Mod Manifest
Add the ClassTransformConfig attribute to your mod's manifest file, pointing to your JSON configuration:
`
ClassTransformConfig: xxxx.classtransform.json
`
Replace xxxx.classtransform.json with your actual file path.
Implement Your Transformer
Create transformer classes in the package you specified. These classes receive class bytecode during the early loading phase, before the mod loader fully initializes. You can now inspect and modify class behavior at the bytecode level—much earlier than standard mixin transformations allow.