Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Forge ConcurrentModificationException registering item property #73

Open
4 tasks done
thebrightspark opened this issue Apr 30, 2023 · 1 comment
Open
4 tasks done
Labels
bug Something isn't working

Comments

@thebrightspark
Copy link

thebrightspark commented Apr 30, 2023

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.
@thebrightspark thebrightspark added the bug Something isn't working label Apr 30, 2023
@SiverDX
Copy link

SiverDX commented May 2, 2023

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants