Jump to content

Recipe.xml - Object reference not set to an instance of an object?? [HELP]


Camiracundus

Recommended Posts

I've been working on re-doing one of my older farm mods to be functional with A21.

It worked perfectly earlier; then all I did was remove 2 recipes from recipe.xml and the matching items from items.xml, fix the name of one recipe ingredient to match its Item name, and now it doesn't work anymore. Or at least, that's what I thought I did; I don't recall doing anything else, and I've scoured both documents to see if any of the three things I touched (Spice Seed, Herb Seed, Cabbage) are unchanged, remaining or hiding, but no such luck; and in the rare instances this happens, the console error usually tells me that it cannot parse recipes because there's no item by a certain ingredient name.

I tried going through process of elimination and had it load perfectly with all but 1 section/line of code (a specific Jar made in a forge) in recipe.xml enabled (I used the <!-- o --> tag), and it worked flawlessly; then I tried simplifying the excluded Jar line that I thought had to be the issue, cause it worked perfectly without it; but when I tried to load again, it spat out the same error.

So I went back to recipes.xml and disabled the newly written Jar code entirely, and fired up the game, expecting it to work just fine - but it spat out that error again. And it keeps doing it now, even when the recipe.xml document consists only of lines that have already worked just fine during my earlier processes. 

I'm about to tear my hair out out of frustration with this issue. Hopefully someone here can shed some light on what's going wrong. Thanks in advance! 

 

I've attached the log from the latest error., but it's this part in particular that pops up the console;

 

2023-10-27T05:45:53 55.593 ERR XML loader: Loading and parsing 'recipes.xml' failed
2023-10-27T05:45:53 55.595 EXC Object reference not set to an instance of an object
  at RecipesFromXml+<LoadRecipies>d__1.MoveNext () [0x002be] in <d7dcfa4979674f179c13273f8b30b551>:0 
  at ThreadManager+<CoroutineWrapperWithExceptionCallback>d__51.MoveNext () [0x00044] in <d7dcfa4979674f179c13273f8b30b551>:0 
UnityEngine.StackTraceUtility:ExtractStringFromException(Object)
Log:Exception(Exception)
<>c__DisplayClass52_0:<loadSingleXml>b__2(Exception)
<CoroutineWrapperWithExceptionCallback>d__51:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

 

 

https://pastebin.com/ewESwXZC

 

Thanks!

Link to comment
Share on other sites

46 minutes ago, BFT2020 said:

Really need to see your recipe code and probably the item / block files.  Initial thought is a typo somewhere in your recipe file.  Could be an unknown edit you did when making changes (I have done it in the past).

Thanks for the response! That was my initial thought, too, but I can't spot whatever it is. Here's the items.xml and the recipes.xml; hopefully you'll be able to make more sense of them than I can! I appreciate the help.

 

I tried to use Pastebin, but the files are too big. I used paste.c instead;

Recipes.xml - https://paste.c-net.org/CarolLeper

Items.xml - https://paste.c-net.org/AnyankaSquared

Blocks.xml - https://paste.c-net.org/GrissomSleaze

 

Edited by Camiracundus
Forgot to add link to blocks.xml file (see edit history)
Link to comment
Share on other sites

1 hour ago, BFT2020 said:

Really need to see your recipe code and probably the item / block files.  Initial thought is a typo somewhere in your recipe file.  Could be an unknown edit you did when making changes (I have done it in the past).

You were absolutely right about it being a typo. I scoured the code again and noticed the tiniest of tiny typos - a q had snuck into an item name, so instead of "Damascus Knife" it read "Damqascus Knife" - and because I had the text size so small, it didn't pop out easily. I corrected it, double-checked there were no others, and fired up the game - and now it runs perfectly.

 

Thank you for the help!

Link to comment
Share on other sites

5 hours ago, Camiracundus said:

You were absolutely right about it being a typo. I scoured the code again and noticed the tiniest of tiny typos - a q had snuck into an item name, so instead of "Damascus Knife" it read "Damqascus Knife" - and because I had the text size so small, it didn't pop out easily. I corrected it, double-checked there were no others, and fired up the game - and now it runs perfectly.

 

Thank you for the help!

yw

 

easy problem solving on my part so far  😆

Link to comment
Share on other sites

21 minutes ago, BFT2020 said:

yw

 

easy problem solving on my part so far  😆

Would you be up for possibly helping with a new issue?

 

I've tried adding this recipe to the game;

<append xpath="/recipes">

<recipe name="Apple Pie" count="1" craft_time="2" craft_area="campfire">
            <ingredient name="Sliced Apples" count="6"/>
            <ingredient name="Flour" count="2"/>
            <ingredient name="foodEgg" count="1"/>
            <ingredient name="resourceAnimalFat" count="1"/>
            <ingredient name="drinkJarBoiledWater" count="1"/>
        </recipe>

</append>

 

And it does exist just fine - but I have to search for it manually in order to get it to show up in a campfire. Is there a way to get it to show up automatically along with the already existing recipes such as the boiled eggs and charred meat?

Link to comment
Share on other sites

3 hours ago, Camiracundus said:

Would you be up for possibly helping with a new issue?

 

I've tried adding this recipe to the game;

<append xpath="/recipes">

<recipe name="Apple Pie" count="1" craft_time="2" craft_area="campfire">
            <ingredient name="Sliced Apples" count="6"/>
            <ingredient name="Flour" count="2"/>
            <ingredient name="foodEgg" count="1"/>
            <ingredient name="resourceAnimalFat" count="1"/>
            <ingredient name="drinkJarBoiledWater" count="1"/>
        </recipe>

</append>

 

And it does exist just fine - but I have to search for it manually in order to get it to show up in a campfire. Is there a way to get it to show up automatically along with the already existing recipes such as the boiled eggs and charred meat?


This sounds like a grouping issue.

In items.xml find the corresponding item (Apple Pie), and add it to the specific group

 

e.g. 

<property name="Group" value="Food/Cooking,CFFood/Cooking"/>

 

Link to comment
Share on other sites

22 minutes ago, BadZombie said:


This sounds like a grouping issue.

In items.xml find the corresponding item (Apple Pie), and add it to the specific group

 

e.g. 

<property name="Group" value="Food/Cooking,CFFood/Cooking"/>

 

Thank you!! I will try that in the morning 😊 I appreciate your help! 

Link to comment
Share on other sites

36 minutes ago, Camiracundus said:

Thank you!! I will try that in the morning 😊 I appreciate your help! 

I couldn't wait to try it, and it works now! Apple Pie shows up clear as day under the campfires recipes without needing to search. 

 

Thank you, you're a lifesaver! 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...