Jump to content

Recommended Posts

Posted (edited)

In my mod I am trying to do a registry override, which works fine, but since the vanilla item didn't have any variants and my override item does, it causes a jsonparseerror on every single recipe that uses the item. I was wondering if there was any way to prevent this (it's caused by the fact that the json recipes don't have a data value as the original item doesn't have one, but since the override does have variants it requires a data value in the json). I looked through the stacktrace of the json error and could not find any place where a mod might hook into the process of loading recipe jsons. I condifered a few possible options to resolve this, but none of them are particularly helpful:

  • before the recipes are parsed, find every json recipe that would cause a jsonerror as a direct result of my override and fix the issue in the json file. This is not a solution since my mod may not always have the permissions to write, and may also cause issues in modloaders that do some form of version-checking or whatever.
  • use some method to catch exceptions from another thread. Not possible since the exception is already caught by the thread itself.
  • look for all recipes that would cause a jsonerror as a direct result of my override, parse them myself, then register the result. While definetely possible this would be a rather inefficient way to do it, and would also not prevent the json errors from occuring.

while the third option is possible, it would be nice to know if there is any point in which a mod can interrupt the recipe loading process (for instance if there's a hook i missed that let's you acess the json object or the loader or something)

Some things of note:

Vanilla recipes seem to be handled by a different loader which is perfectly capable of ignoring wheter or not an item has variants.
I can't fix the recipe registry entries after the fact, since the json error prevents the recipes from entering the registry in the first place.

Edited by DutchM
clarify
Posted (edited)

Does having your own correct recipes in assets/minecraft/recipes work?

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Yes, recipes aren't broken in general, it's just that recipes that use string that don't set a data tag are broken, and I have no control over what other modders do with their recipes, so I would like to make it so my mod fixes those recipes (that is, other mod's json recipes that use vanilla string).

Posted

I think you could probably make your own IRecipe implementation and wrap the vanilla one to fix those conflicts. Just an idea tho

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

"the vanilla item didn't have any variants and my override item does"

That is your problem.

When replacing a registry item, do not add variants. You must replace the item exactly as is. if you need more then add an extra registry entry and translate them as needed.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
7 minutes ago, LexManos said:

"the vanilla item didn't have any variants and my override item does"

That is your problem.

When replacing a registry item, do not add variants. You must replace the item exactly as is. if you need more then add an extra registry entry and translate them as needed.

I'm fully aware that that is the cause of the issue. I'm looking for a way to circumvent the issue without changing that. As far as I can tell using some reference searches in Eclipse, recipes are the only thing that break by doing this. 

Posted

Variants should be separate items in 1.13 anyway, so I think you should have the vanilla one as your default variant. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
Just now, Cadiboo said:

Variants should be separate items in 1.13 anyway, so I think you should have the vanilla one as your default variant. 

I can definitely do that, and I probably will if there's really no circumventing this, but I'd really prefer seeing if there's a way to circumvent it since that wouls save alot of work rn, and also be clearer to the player imo. 

Posted
16 minutes ago, DutchM said:

I can definitely do that, and I probably will if there's really no circumventing this, but I'd really prefer seeing if there's a way to circumvent it since that wouls save alot of work rn, and also be clearer to the player imo. 

You can still change the texture and the name of the object, there should be no difference to the end user

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
Just now, Cadiboo said:

You can still change the texture and the name of the object, there should be no difference to the end user

There is when using commands etc. Shouldn't be too big of a deal but eh there's no way to circumvent the error anyway so I suppose I'll have to redo my colored string. 

Posted

"You shouldn't do that as that is now what the system is designed for"

"I still wanna do the thing even tho you just told me that it is the wrong way to do it because... I'm special..."

Seriously? No. Don't 'circumvent it' just use the system the way it was designed.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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