Confusing error when registering a duplicate typewrapper
ChiefArug opened this issue ยท 4 comments
Minecraft Version
1.18.2
KubeJS Version
1802.5.5-build.548
Rhino Version
1802.2.1-build.239
Architectury Version
4.9.84
Forge/Fabric Version
40.1.80
Describe your issue
I attempted to register a type wrapper for net.minecraft.world.item.Tier
, not realizing that one already exists.
Booting the game succeeded, however an error appeared in startup.txt saying Failed to read script pack startup_scripts: : java.lang.IllegalArgumentException: Wrapper for class net.minecraft.world.item.Tier already exists!
Which isnt a very nice or correct error, especially for an end user.
This probably isnt an easy problem to solve though, if I understand correctly how the type wrapper registration works.
Crash report/logs
https://gist.github.com/ChiefArug/2a15a0b936a0e99ceee1a6eb4ee57797#file-latest-log
I think the error exactly tells the problem. No packdev should ever receive this error. It's an error for addon dev's, it should not even boot in my opinion. On the other hand there is no way to check if a wrapper exist.
Packdevs could encounter this error if they install multiple addons that add the same wrappers, or if an addon/KubeJS updates and adds a type wrapper and another addon already has a wrapper for that.
By it not being a good error I mean the timing (it shouldn't cause a script pack to fail to load, it should cause the plugin to fail to load), and the fact it doesnt have who's registering the typewrapper (in case it is a packdev encountering it)
Can you look if the error is also thrown into the normal log with the full stacktrace?
By it not being a good error I mean the timing (it shouldn't cause a script pack to fail to load, it should cause the plugin to fail to load), and the fact it doesnt have who's registering the typewrapper (in case it is a packdev encountering it)
I totally agree with this