
Potential CME on (Neo)Forge due to registering game rules in common setup event
ChiefArug opened this issue ยท 0 comments
In the common setup event you make a call to your game rule class to register them:
Adorn/forge/src/main/java/juuxel/adorn/platform/forge/Adorn.java
Lines 85 to 86 in 0eaf048
This has the potential to cause a Concurrent Modification Exception because the common setup event runs in parallel for multiple mods at the same time and GameRules#register adds an entry to a non threadsafe map. Issues caused by this would be very hard to reproduce and hard to pin the blame on the cause (as only one modifier shows up in the stacktrace).
You should instead ensure that it is enqueued in that event to run on the main thread using the enqueueWork method.