Non thread-safe dispenser behavior registration
pau101 opened this issue ยท 2 comments
The current dispenser behavior registration is not thread safe, as FMLCommonSetup
is a parallel dispatched event and DispenserBlock#registerDispenseBehavior
does not support concurrency. When additional mods are installed which have this similar code the game may fail to load from the internal registry map being put into a bad state.
Stacktrace:
java.lang.ArrayIndexOutOfBoundsException: 1024
at it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap.rehash(Object2ObjectOpenHashMap.java:906) ~[?:?]
at it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap.insert(Object2ObjectOpenHashMap.java:273) ~[?:?]
at it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap.put(Object2ObjectOpenHashMap.java:281) ~[?:?]
at net.minecraft.block.DispenserBlock.func_199774_a(SourceFile:46) ~[?:?]
at andrews.pandoras_creatures.registry.util.PCDispenserBehaviors.registerAll(PCDispenserBehaviors.java:47) ~[?:1.14.4-0.13.1]
at andrews.pandoras_creatures.Main.setupCommon(Main.java:91) ~[?:1.14.4-0.13.1]
The typical remedy is to use DeferredWorkQueue
as you have so far for entity spawn registration. This issue also applies to the current feature registration as that is not concurrent either.