Skip to content

registerReloadListener called on wrong thread during ShetiPhianCore.clientSetup - 1.20.1 #488

Description

@Jmpp2909

Describe the bug

While reviewing logs during an update of the AllTheMods 9 Sky modpack, ModernFix intercepted an error indicating that ShetiPhianCore is calling registerReloadListener on the wrong thread.

The stack trace points to shetiphian.core.client.model.PackTextureOverrideHandler.init being called during FMLClientSetupEvent (ShetiPhianCore.clientSetup:L79). According to ModernFix documentation, resource reload listeners should not be added in FMLClientSetupEvent or FMLCommonSetupEvent because they fire in parallel with vanilla triggering the resource reload. This can lead to the listener being ignored or causing random ConcurrentModificationException crashes.

The recommended solution is to avoid using the vanilla registerReloadListener method directly and instead utilize Forge's platform-provided RegisterClientReloadListenersEvent for clients.

https://github.com/embeddedt/ModernFix/wiki/registerReloadListener-called-on-wrong-thread

Additional context

  • Minecraft Version: 1.20.1
  • ModLoader & Version: Forge 47.4.10
  • Side: Client / SinglePlayer
  • ShetiPhian Core Version: 1.20.1 - 1.5
  • My Mod(s) Name & Version: EnderTanks 1.5 & EnderChests 1.4

Are other mods present?

  • Yes, this occurred within the AllTheMods 9 Sky modpack environment.
  • Does everything work without my mods?
    Yes, the warning disappears when the mods are removed.
  • Have you tested with only my mods?
    No, but the provided stack trace explicitly isolates the thread violation to ShetiPhianCore.clientSetup.

PasteBin or GitHub Gists links

Relevant log snippet for reference:

[10:59:30] [Worker-ResourceReload-11/ERROR]: A mod is calling registerReloadListener at the wrong time. This will cause random concurrency crashes when ModernFix is not installed. Please report this to them. If you are a modder, refer to https://github.com/embeddedt/ModernFix/wiki/registerReloadListener-called-on-wrong-thread for more information.java.lang.Exception: registerReloadListener called on wrong thread
	at net.minecraft.server.packs.resources.ReloadableResourceManager.wrapMethod$zgh000$checkCallingThread:L540
	at net.minecraft.server.packs.resources.ReloadableResourceManager.m_7217_(ReloadableResourceManager.java) ~[client-1.20.1-20230612.114412-srg.jar%23773!/:?]
	at shetiphian.core.client.model.PackTextureOverrideHandler.init:L47
	at shetiphian.core.ShetiPhianCore.clientSetup:L79
	at net.minecraftforge.eventbus.EventBus.doCastFilter:L260
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11:L252
	at net.minecraftforge.eventbus.EventBus.post:L315
	at net.minecraftforge.eventbus.EventBus.post:L296
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent:L121
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$5:L127

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions