Minecraftforge: [1.12] Overriding a registry entry from the same owner crashes the game with an unobvious message

Created on 4 Jul 2017  路  9Comments  路  Source: MinecraftForge/MinecraftForge

Forge version: 1.12-14.21.1.2395
Test mod: link

When one mod registers two different objects with the same name, the second one will override the first as expected.

However, since both the old and the new objects have the same owner (mod ID), the new OverrideOwner and object will replace the old one in the ForgeRegistry#owners BiMap.

When ForgeRegistry#sync is called, it will log this warning for the old value and then crash the game with this exception.

If the old and new objects have different owners, the old OverrideOwner and object will be preserved and this won't happen.

Since it doesn't make much sense to override an object from your own mod, it might be best to detect this and throw an IllegalArgumentException in ForgeRegistry#add.

Stale

Most helpful comment

This issue is still present.

All 9 comments

Is this possibly related to/caused by #4129? That issue points to a case where the owner is compared to a string of the owner thus they can never be equal, thus skipping preventing from skipping some code.

I don't think the issues are directly related. This issue removes the OverrideOwner for the old name, so it won't reach that check.

Why would you ever override your own stuff?

Because of a mistake. As far as I understand it, the intend of this issue is to make the error message more descriptive.

Alright, I'd just say if someone tries to override themselves, then error in the add method instead of elseware. It'll be on my list of things to do later.

This issue has been automatically marked as stale because it has not had activity in a long time, and will be closed if no further activity occurs. If this issue was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions.

This issue is still present.

This issue has been automatically marked as stale because it has not had activity in a long time. If this issue is still relevant and should remain open, please reply with a short explanation (e.g. "I have checked the code and this issue is still relevant because ___." or "Here's a screenshot of this issue on the latest version"). Thank you for your contributions!

This issue has been automatically closed because it has not had activity in a long time. Please feel free to reopen it or create a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juliand665 picture juliand665  路  3Comments

DaedalusGame picture DaedalusGame  路  3Comments

williewillus picture williewillus  路  3Comments

williewillus picture williewillus  路  3Comments

MSandro picture MSandro  路  3Comments