Jump to content

registry override prevent json parse error


DutchM

Recommended Posts

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
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

"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

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

"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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • @bluedisgusted That actually fully fixed it, thank you so much
    • Hi, I would like to know how to create multiple hitboxes for the player like the ender dragon. I've searched everywhere but I haven't found anything.
    • FOLKWIN EXPERT RECOVERY is the crypto hero we all need in the ongoing battle against cryptocurrency theft. With the rise in popularity of digital assets like Bitcoin and Ethereum, crypto crime has also been on the rise as hackers look to steal funds stored in virtual wallets. Many a crypto investor has fallen victim to clever scams and hacking schemes that drain wallets of their precious coins. But fear not, for FOLKWIN EXPERT RECOVERY has arrived as a beacon of hope for those who have had their hard-earned crypto stolen. This service is like a superhero for tracking down lost or stolen cryptocurrency, utilizing their advanced forensic technology and expertise to follow the blockchain paper trail and identify where your funds have gone. Their team of ethical hackers act like detectives, piecing together crypto transactions and unmasking the thieves behind complex cybercrimes. No case is too difficult for FOLKWIN EXPERT RECOVERY; they have recovered millions in stolen crypto assets from around the globe. Their mission is to reunite victims with their lost funds and bring criminals who prey on cryptocurrency investors to justice. With their help, those who have been robbed of their digital fortunes now have a crypto guardian to call upon in their time of need. FOLKWIN EXPERT RECOVERY gives victims the hope that all is not lost forever when crypto theft occurs.For support, Contact details is: TELEGRAM: @FOLKWIN_EXPERT_RECOVERY, EMAIL: FOLKWINEXPERTRECOVERY at TECH-CENTER dot COM, WEBSITE: WWW.FOLKWINEXPERTRECOVERY.COM .  are the heroes we need in the ongoing battle to make cryptocurrency ownership safe and secure for all. Get FOLKWIN EXPERT RECOVERY on your side when you have issues like this by dialing: Do this and thank me later. God Blessings to all, I'm forever grateful oh God for the successful recovery. I recommend FOLKWIN EXPERT RECOVERY the best ever and i'm so happy i got all my lost money back. Best Regards. Pamela K Ingram.
    • Made it work. As a note, one of the times it didn't recognize the recipe cause the MOD_ID constant I was using somewhere was NOT referencing my MOD_ID but rather another static variable with the same name. Maybe OP is having a similar problem
    • What exactly is the issue?
  • Topics

×
×
  • Create New...

Important Information

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