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

Fix "value already present" error on reloading #203

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

juraj-hrivnak
Copy link
Contributor

This fixes a rare error when an entry is already present in the registry on reloading.

Copy link
Collaborator

@WaitingIdly WaitingIdly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have reproduction steps to get the error? regardless, given that this is forceAdd, having the method be forcePut seems correct to me and i havent noticed any errors when testing.

@brachy84 brachy84 added the bug Something isn't working label Jul 22, 2024
@juraj-hrivnak
Copy link
Contributor Author

juraj-hrivnak commented Jul 22, 2024

Unfortunately, I don't have reproduction steps. This error only says the recipe already present is: net.minecraftforge.oredict.ShapedOreRecipe@21d4a83, which isn't very helpful. I don't know which registry or mod is causing this, but it is clear that HashBiMap#put throws an error when it's not HashBiMap#forcePut.

java.lang.IllegalArgumentException: value already present: net.minecraftforge.oredict.ShapedOreRecipe@21d4a83
	at com.google.common.collect.HashBiMap.put(HashBiMap.java:287) ~[guava-21.0.jar:?]
	at com.google.common.collect.HashBiMap.put(HashBiMap.java:262) ~[guava-21.0.jar:?]
	at net.minecraftforge.registries.ForgeRegistry.groovyScript$forceAdd(ForgeRegistry.java:1235) ~[ForgeRegistry.class:?]
	at net.minecraftforge.registries.ForgeRegistry.groovyScript$onReload(ForgeRegistry.java:1168) ~[ForgeRegistry.class:?]
	at com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper.onReload(ForgeRegistryWrapper.java:37) ~[ForgeRegistryWrapper.class:?]
	at com.cleanroommc.groovyscript.compat.vanilla.VanillaModule.onReload(VanillaModule.java:45) ~[VanillaModule.class:?]
	at com.cleanroommc.groovyscript.registry.ReloadableRegistryManager.onReload(ReloadableRegistryManager.java:79) ~[ReloadableRegistryManager.class:?]
	at com.cleanroommc.groovyscript.sandbox.GroovyScriptSandbox.preRun(GroovyScriptSandbox.java:327) ~[GroovyScriptSandbox.class:?]
	at com.cleanroommc.groovyscript.sandbox.GroovySandbox.load(GroovySandbox.java:100) ~[GroovySandbox.class:?]
	at com.cleanroommc.groovyscript.sandbox.GroovyScriptSandbox.run(GroovyScriptSandbox.java:152) ~[GroovyScriptSandbox.class:?]
	at com.cleanroommc.groovyscript.GroovyScript.runGroovyScriptsInLoader(GroovyScript.java:186) ~[GroovyScript.class:?]
	at com.cleanroommc.groovyscript.command.GSCommand.runReload(GSCommand.java:58) ~[GSCommand.class:?]
	at com.cleanroommc.groovyscript.network.CReload.executeServer(CReload.java:19) ~[CReload.class:?]
	at com.cleanroommc.groovyscript.network.NetworkHandler.lambda$static$2(NetworkHandler.java:65) ~[NetworkHandler.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_391]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_391]
	at net.minecraft.util.Util.runTask(SourceFile:529) [h.class:?]
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:723) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668) [MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:185) [chd.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:1817) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_391]

@brachy84 brachy84 merged commit bbeaefd into CleanroomMC:master Jul 23, 2024
@juraj-hrivnak juraj-hrivnak deleted the fix-reg-error branch July 24, 2024 11:00
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

Successfully merging this pull request may close these issues.

3 participants