Spirit

Spirit

11M Downloads

[Bug]: Forge ConcurrentModificationException registering item property

thebrightspark opened this issue ยท 1 comments

commented

Bug Description

Had a rare case of a ConcurrentModificationException during initialisation involving the registering of an item property on Forge.

How to Reproduce?

  1. Install Spirit
  2. Startup client

Expected Behavior

Client starts up fine every time

Version

2.2.4

Mod Loader Version

1.19.2 - 43.2.8

Mod Loader

Forge

Logs or additional context

https://pastebin.com/07Ppm4rM

[13:15:02] [Worker-Main-11/INFO]: Initializing client setup phase...
[13:15:02] [Worker-Main-8/ERROR]: Exception caught during firing event: null
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: class me.codexadrian.spirit.forge.ForgeSpiritClient onInitializeClient(Lnet/minecraftforge/fml/event/lifecycle/FMLClientSetupEvent;)V
java.util.ConcurrentModificationException
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1221)
	at TRANSFORMER/[email protected]/net.minecraft.client.renderer.item.ItemProperties.register(ItemProperties.java:53)
	at TRANSFORMER/[email protected]/me.codexadrian.spirit.platform.forge.ForgeClientHelper.registerItemProperty(ForgeClientHelper.java:26)
	at TRANSFORMER/[email protected]/me.codexadrian.spirit.SpiritClient.initClient(SpiritClient.java:28)
	at TRANSFORMER/[email protected]/me.codexadrian.spirit.forge.ForgeSpiritClient.onInitializeClient(ForgeSpiritClient.java:26)
	at TRANSFORMER/[email protected]/me.codexadrian.spirit.forge.__ForgeSpiritClient_onInitializeClient_FMLClientSetupEvent.invoke(.dynamic)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:107)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:122)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

[13:15:02] [Worker-Main-8/ERROR]: Caught exception during event FMLClientSetupEvent dispatch for modid spirit
java.util.ConcurrentModificationException: null
	at java.util.HashMap.computeIfAbsent(HashMap.java:1221) ~[?:?]
	at net.minecraft.client.renderer.item.ItemProperties.register(ItemProperties.java:53) ~[client-1.19.2-20220805.130853-srg.jar%23341!/:?]
	at me.codexadrian.spirit.platform.forge.ForgeClientHelper.registerItemProperty(ForgeClientHelper.java:26) ~[spirit-forge-1.19.2-2.2.4.jar%23328!/:?]
	at me.codexadrian.spirit.SpiritClient.initClient(SpiritClient.java:28) ~[spirit-forge-1.19.2-2.2.4.jar%23328!/:?]
	at me.codexadrian.spirit.forge.ForgeSpiritClient.onInitializeClient(ForgeSpiritClient.java:26) ~[spirit-forge-1.19.2-2.2.4.jar%23328!/:?]
	at me.codexadrian.spirit.forge.__ForgeSpiritClient_onInitializeClient_FMLClientSetupEvent.invoke(.dynamic) ~[spirit-forge-1.19.2-2.2.4.jar%23328!/:?]
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%2385!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%2385!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%2385!/:?]
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:107) ~[javafmllanguage-1.19.2-43.2.8.jar%23343!/:?]
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:122) ~[fmlcore-1.19.2-43.2.8.jar%23342!/:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) [?:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) [?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) [?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) [?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) [?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) [?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) [?:?]

Code of Conduct

  • I have searched the issue tracker and confirmed that the issue has not been reported
  • I have checked the FAQ (if one is present) and my issue is not listed
  • I have verified that I am using the latest version of the mod
  • I have verified that I do not have Optifine installed. We will close issues if we detect Optifine is in your pack. We cannot fix Optifine issues. Please do not report issues with Optifine present.
commented
    @Override
    public void registerItemProperty(Item pItem, ResourceLocation pName, ClampedItemPropertyFunction pProperty) {
        ItemProperties.register(pItem, pName, pProperty);
    }

With Forge you would normally do this but I'm not sure how Architectury handles this
https://docs.minecraftforge.net/en/latest/resources/client/models/itemproperties/

Architectury (seems like a different setup):
https://docs.architectury.dev/api/registry