SpASM Mod Wiki › FAQ
SpASM Mod FAQ
10 questions players actually ask, answered.
How do I register a class transformer in SpASM?
Create a class that implements the ClassTransformer interface, then register it using the spasm:transformer entrypoint in your mod's metadata file. SpASM will automatically call your transformer on all classes during the loading phase.
Do I need to know exact class names to use SpASM?
No—that's the main advantage of SpASM. Your transformer receives every class being loaded, so you can scan and match classes by their methods, fields, or bytecode patterns instead of hardcoding names.
What's the difference between SpASM and Mixin?
SpASM gives you raw bytecode access to scan all classes without specifying targets upfront, while Mixin requires you to declare target classes and methods explicitly. SpASM is better for broad code analysis; Mixin is better for precise, targeted patches.
Can multiple mods use SpASM at the same time?
Yes. Each mod registers its own transformers via the spasm:transformer entrypoint, and SpASM applies all of them during class loading. Order of execution depends on mod load order.
How do I debug if my transformer isn't running?
Check that your entrypoint is correctly declared in your mod metadata and that your ClassTransformer class is properly implemented. Add logging statements at the start of your transform method to confirm it's being called, and verify the class names you're matching against.
Will SpASM slow down my game startup?
SpASM processes every class during loading, so heavy or inefficient transformers can impact startup time. Keep your scan logic fast and only modify classes you actually need to change.
Can I modify classes from other mods with SpASM?
Yes. Your transformer sees all classes loaded into the game, including those from other mods, so you can scan and modify them by matching their bytecode patterns or method signatures.
What happens if my transformer throws an exception?
The class loading will fail and your game may crash or refuse to start. Always wrap risky bytecode operations in try-catch blocks and log errors so you can identify what went wrong.
How do I inject code into a method I found with SpASM?
Use a bytecode manipulation library (like ASM) within your ClassTransformer to locate the method's bytecode and insert your instructions at the appropriate point—typically at the method start, before returns, or around specific opcodes.
Is SpASM compatible with Java 8 and newer versions?
SpASM works with modern Java versions, but ensure your bytecode manipulation code targets the correct class file format for your game's Java version to avoid compatibility issues.