Lucreeper74 / Create-Metallurgy

Add-on for Create Mod, adding new metallurgy processings.
https://modrinth.com/mod/create-metallurgy
MIT License
12 stars 8 forks source link

[BUG 🐜] Datapack error on world load with 0.0.4 #15

Closed brisingraerowing closed 2 months ago

brisingraerowing commented 2 months ago

Describe the bug Datapack error on world load

To Reproduce Steps to reproduce the behavior:

  1. Load world with 0.0.4
  2. Error

Expected behavior World loads

Screenshots If applicable, add screenshots to help explain your problem.

Environment:

Additional context This is an existing world.

Lucreeper74 commented 2 months ago

Hello! @brisingraerowing :wave: Sorry for your disappointment, to help me fix the bug, can you please give me a CrashReport / Logs and maybe after that what datapack are you using, does it is for add new recipes? I would be happy to be able to resolve the problem quickly tomorrow (cause French hours).

ocram9 commented 2 months ago

I think I got the same issue, datapack error when loading an existing world. Didn't get the error when just using Create and this mod though so it seems to be an incompatibility. Don't really have time now to look into which mod could cause it. Maybe the logs will help narrow it down but I'm not experienced enough for that.

When making a new world the game crashes with this crash log: https://gist.github.com/ocram9/5677075fb70513401a238d7e501189ea

And this is the log where it gives the datapack error: https://gist.github.com/ocram9/f1715bddfde11de804c82abecde473f9

Ahniolator commented 2 months ago

Same issue here with server log attached. It appears to only happen on my dedicated server, the client runs just fine.

latest.log

slava110 commented 2 months ago

@Lucreeper74 this is caused by wrong recipe JSON for Create Enchantment Industry compat. results instead of result in JSON. https://github.com/Lucreeper74/Create-Metallurgy/blob/4ba7bea942ecdb699243da866b1d175311311525/src/main/resources/data/createmetallurgy/recipes/compat/create_enchantment_industry/spout_experience_nugget.json#L19 while code expects result field and throws NPE https://github.com/Lucreeper74/Create-Metallurgy/blob/4ba7bea942ecdb699243da866b1d175311311525/src/main/java/fr/lucreeper74/createmetallurgy/content/casting/recipe/CastingRecipeSerializer.java#L31-L33 Btw, maybe you should check if required field exists in JSON and just give a warning or more readable error (with recipe ID and such) instead of crashing the game 🙃

Lucreeper74 commented 2 months ago

Yes, my bad, I wanted to finish this quickly to release the update as quickly as possible to avoid waiting too long. I forgot that. I will post a hotfix. I don't kow if I just replace v0.0.4 on Modrinth/Curseforge pages or just upload v0.0.5 or v0.0.4a with just that fix

Lucreeper74 commented 2 months ago

@Lucreeper74 this is caused by wrong recipe JSON for Create Enchantment Industry compat. results instead of result in JSON.

https://github.com/Lucreeper74/Create-Metallurgy/blob/4ba7bea942ecdb699243da866b1d175311311525/src/main/resources/data/createmetallurgy/recipes/compat/create_enchantment_industry/spout_experience_nugget.json#L19

while code expects result field and throws NPE https://github.com/Lucreeper74/Create-Metallurgy/blob/4ba7bea942ecdb699243da866b1d175311311525/src/main/java/fr/lucreeper74/createmetallurgy/content/casting/recipe/CastingRecipeSerializer.java#L31-L33

Btw, maybe you should check if required field exists in JSON and just give a warning or more readable error (with recipe ID and such) instead of crashing the game 🙃

I will close this issue when i do that you said 👍

slava110 commented 2 months ago

Yeah. I'm not sure how other mods handle stuff like that, you can probably check 🤷

Lucreeper74 commented 2 months ago

I take a look at how Create verify their Json files. They just use : GsonHelper.getAsJsonObject(json, {name}) And this function just throw error without crash (I think i will test) when not found. The worst part is that I used it a few lines before... I'm so dumb lmao

Lucreeper74 commented 2 months ago

Yes, after test it, it return this [13:57:01] [Render thread/ERROR] [minecraft/RecipeManager]: Parsing error loading recipe createmetallurgy:compat/create_enchantment_industry/spout_experience_nugget com.google.gson.JsonSyntaxException: Missing result, expected to find a JsonObject

Its an error but it won't crash the game.

Fixed here commit