Pandoras Creatures

Pandoras Creatures

3M Downloads

Non thread-safe dispenser behavior registration

pau101 opened this issue ยท 2 comments

commented

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.

commented

Ill make sure to fix this in the 1.16 version thanks for pointing it out.

commented

Just want to point out that this has been fixed in the 1.16.3-2.0.0 version. I wont close the issue because I will probably still release a bug fix version for 1.15.2 and maybe 1.14.4