-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Your CleanroomMC Discord Username
ChaosStrikez
Cleanroom Version
0.3.2-alpha
Java Version
Java 21
Graphics Card Vendor
NVidia
Bug Report
The changes in #330 means the codepath taken for registering event handlers is slightly different. This surfaces a bug within Storage Drawers (SD) loading client-side classes on dedicated servers with the following flow:
- Storage Drawers registers its
Thaumcraftintegration to the Forge event bus. - The class has a method signature referencing a client-only class
BufferBuilder. - The optimized event handler class scanning as of Cleanroom 0.3.1-alpha means each method is scanned lazily in order, possibly skipping the call to
Class#getDeclaredMethod(). - In Cleanroom, the class and its method signatures will not cause class loading until the first
getDeclaredMethod(), which is on a super-method.
** In Forge, the very first method scanned will callgetDeclaredMethod(), which will immediately class-loadBufferBuilder, detect, and throw an exception inSideTransformer, so the next step will not occur. - However, this super-method is only scanned after
onDrawerPopulated(), so the event listener foronDrawerPopulatedis registered, and then the sidedness exception is thrown.
Normally, this should all result in the server crashing, but SD swallows the exception, allowing the server to continue as normal besides logging the error. This is the extent to which any issues would arise in Forge. However, in Cleanroom, this results in SD's class in an odd state where the event subscriber was registered, but the fields weren't initialized. This will result in an error (possibly crash) every time the event is posted when storage drawers' items are updated, like so https://mclo.gs/cqQgXnY.
I can submit a PR to SD if necessary to prevent client-only class loading like so, but maybe some changes on Cleanroom's side as a safeguard would be good? Some options I can think of:
- Unconditionally force a call to
Class#getDeclaredMethod()on the first method scan - Have the first method scanned be one that is not a direct public instance/static method (i.e. a superclass method) to force class-loading
- Use
getDeclaredPublicMethod()instead ofgetDeclaredMethod()as event listeners can only bepublic? (only fixes this specific case) - Handle exceptions directly during
EventBus#register()and unregister anything done during the call? - Revert the class scanning changes
Mod List
Minimal mods:
- Fugue-0.18.5
- Baubles-1.12-1.5.2
- Chameleon-1.12-4.1.3
- StorageDrawers-1.12.2-5.5.3
- Thaumcraft-1.12.2-6.1.BETA26
Final Checklist
- I have searched the issues and haven't found a similar issue.
- I have read the readme and know that what is action build.
- I have installed Fugue and it didn't fix my issue.
- I have installed Scalar and it didn't fix my issue.
- I have switched my Forgelin and LibrarianLib to continuous versions(check readme for more detail).
- I am running a test build from Cleanroom Github Actions. (Or, if I've compiled it myself I plan to fix the issue)