Jump to content

Detect changes in Crafting List and which mod altered them


Cephrus

Recommended Posts

I'm creating a mod, and in order for me to control it I want to stop any mod from altering it's recipes or functions.

 

I want to see if a mod is altering the crafting array, and which mod is doing it.

My current setup involves cloning the list and storing it in a separate class during pre-initialization, then during initialization check to see if they are the same.

 

The problem with that solution is it's unclear which mod is altering the array, and also mods may add their own recipes during pre-initialization, which would indicate a flaw. Also, if the mod that alters the array loads before my mod, then the clone of the array will be the same as the altered array, meaning that the mod could get around the checks.

 

How would I go about doing this while allowing mods that add recipes during pre-init (which they shouldn't be doing) not trigger the check?

Link to comment
Share on other sites

I don't think this is a good idea. Every "protection" (I can think of) can be circumvented, if some modder would want to modify your recipes, he/she (if knowledgeable enough) will.

 

If I understood it correctly what you're doing then you're checking if any mod changed crafting list (e.g. added it's own recipe using only its stuff) - you should check only your recipes. But even then one might (via reflection) change internals of your recipe so you'd have to do a deep checking. But then some mod could change your backup copy of your recipes (reflection?). Or the mod could just wait until you make a check and modify all recipes later. You could check all your recipes periodically, but that would cost some player's resources and could be still circumvented - e.g. just before your check just switch to "good" recipe set and after check switch again. Or via ASM rewrite crafting code entirely. There is surely more ways of protection and more ways of bypassing...

 

You can't really have 100% control over your recipes - it all boils down to whether other modders respect your wish regarding recipe changes.

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.