Thread safety of ItemPropertiesRegistry.register on Forge
zbx1425 opened this issue ยท 2 comments
ItemPropertiesRegistry.register
calls the vanilla ItemProperties.register
, which does computeIfAbsent
on a static HashMap, which is not thread safe.
When calling it from CLIENT_SETUP
which is called from the parallel executing FMLClientSetupEvent
, there can be read/write conflicts with other mods and result in ConcurrentModificationException
.
This is not an issue on Fabric since it doesn't execute entry point functions in multiple threads.
Is this an Architectury API issue, or if I should call ItemPropertiesRegistry.register
from somewhere else?
I've read the Architectury API documentation didn't notice entries mentioning thread safety.