Modding Help I found out what cause crashes in Stardew 1.2

Discussion in 'Mods' started by mmanlapat, Apr 25, 2017.

  1. mmanlapat

    mmanlapat Poptop Tamer

    Some (not all) xnb files in Stardew 1.11 have different .yaml format compare to 1.2
    So if the mod you're using is replacing some XNB that got a format update, your game crashes.

    for example (see attachment)
    LEFT <<< Stardew 1.2 -----|||----- RIGHT >>> Stardew 1.11

    the ObjectInformation.xnb have a different format now, so if a mod changes this, the game crashes.
     

      Attached Files:

      wererat2000 and KThxBye910 like this.
    • BrandonPotter0

      BrandonPotter0 Big Damn Hero

      Wow, good find!
       
      • MysticTempest

        MysticTempest Spaceman Spiff

        Well, it depends on the crash, but yes some of the recent ones are due to the new changes.

        Specifically, if you see an error similar to this. Where the game has issues with items in your inventory as it tries to load the bad data.
        Code:
        An error occured in the base update loop: System.IndexOutOfRangeException: Index was outside the bounds of the array.
          at StardewValley.Object.getDescription()
          at StardewValley.Menus.InventoryMenu.hover(Int32 x, Int32 y, Item heldItem)
          at StardewValley.Menus.ItemGrabMenu.performHoverAction(Int32 x, Int32 y)
          at StardewValley.Game1.updateActiveMenu(GameTime gameTime)
          at StardewValley.Game1.Update(GameTime gameTime)
        
        I came across it back in February while testing my mod in the Beta. The good thing is once updated; it's pretty simple to extend the new data for the other languages and support the new localizations.
         
        • Karmylla

          Karmylla Space Kumquat

          I've been checking the other data files, and I noticed that "Monsters.xnb" has the same exact issue.
          The new update requires a new entry at the very end of the line, with the name of the Monster (in this case - in the OP's case, it is the name of the Object).

          [​IMG]
           
            KThxBye910 likes this.
          • Ghostly Fox

            Ghostly Fox Heliosphere

            So... How do you accommodate for this? (And do we have a list of what files were changed? Should one be made?)
             
            • BrandonPotter0

              BrandonPotter0 Big Damn Hero

              Do we know exactly what XNBs would need updating? A list of affected XNB files would make it easier to know what needs updating or not.
               
              • tinkerbelljln

                tinkerbelljln Pangalactic Porcupine

                I am by no means a modder in any way shape or form, but like replacing some xnbs still works, like furniture.xnb but the ones that are now sort of duplicated for the different languages are the ones that seem to cause problems. At least, this seems to be the trend I've noticed in messing around with my files today. Like this is a screen grab of my Maps folder, so like AdventureGuild, AnimalShop, the barns, they're fine, but see how the BathHouse_Entry and Beach and Beach-Jellies has multiples for the different languages? That seems to be where the issue comes in. Unfortunately as I said I'm not a modder at all, so I have no clue at all how to fix this.
                Capturesfddf.PNG
                EDIT: Wouldn't it be nice if we could just delete the other files? Like I hope there's a fix, but being able to just safely delete the files if you're an English speaker/don't mind not having it in your language would be so nice.
                 
                • mmanlapat

                  mmanlapat Poptop Tamer

                  As of now, I dont have Stardew Valley 1.11 anymore so I can't check every file. I just noticed the one file that I currently modded that the file has changed, so might as well share the info.
                   
                  • Entoarox

                    Entoarox Oxygen Tank

                    You can safely remove the .ln-LN versions, if the game cant find a .ln-LN version of a file, it will use the normal version.
                     
                      tinkerbelljln likes this.
                    • tinkerbelljln

                      tinkerbelljln Pangalactic Porcupine

                      *squeals* That seems to have fixed all the problems I had with things going buggy with my xnbs! Now all that's buggy for me is being unable to plant the extra trees that come with the More Crops Mod in Longevity, and I already notified them about that. Thank you so so so much, yesterday the issues made the game unplayable and as it's my favorite game and one of my main stress relievers that wasn't good. I swear you're a superhero!
                       
                      • MysticTempest

                        MysticTempest Spaceman Spiff

                        The Longevity version of More Crops is also doing that? By any chance does it work if you hoe the dirt first?

                        My compatibility version of the More Crops Unoffficial Continuation mod by TenkoKuugen with my Tea mod is also having issues with the new trees. I noticed I can plant them if I hoe the dirt first; but if I don't it prevents me from planting the new saplings.
                        I think it might be something hardcoded in v1.2. Like perhaps the game has a strict list of default saplings, and any new ones are acting more like crops.
                         
                        • tinkerbelljln

                          tinkerbelljln Pangalactic Porcupine

                          I literally JUST posted in the Longevity thread that if I hoe the spot first it plants like a normal tree lol It occurred to me randomly just to try it. It's such a minor thing I don't mind at all. It is something introduced in 1.2 because I could plant them like other trees before. But like I said, it's a minor thing, I hoe the spot and put the tree and it pops up as a sapling just like the other trees.
                           
                            MysticTempest likes this.
                          • Entoarox

                            Entoarox Oxygen Tank

                            I just had a look at the sapling planting code, and as long as the saplings unlocalized name has `Sapling` in it, the game should treat it as a sapling just like it did back in 1.11, if it doesnt, then something weird is going on behind the scenes :S
                             
                            • MysticTempest

                              MysticTempest Spaceman Spiff

                              Thanks for taking a look at the sapling planting code! The MoreCrops fruit trees do indeed have 'Sapling' in their name. That part was unchanged from previous versions.

                              I just tried swapping the data for the Apricot Sapling with the Coal Sapling from MoreCrops; and it seems their planting ability also gets swapped. Coal is now plantable as before, and Apricots now have to have the dirt hoed first.

                              So, I'm guessing the devs added in a separate whitelist for the fruit trees' ObjectID numbers; in addition to the code you saw.
                              It's a bit weird, but having to hoe the dirt first is a simple enough workaround.
                               
                              • Entoarox

                                Entoarox Oxygen Tank

                                Yep, going by what you said I looked into other sections of the code, and there is a whole whitelist for the sapling item ID's in there... moving them to another category should allow them to be placed as you could in 1.11 since the extra verification only cares about items in the -19 and -74 categories, if the sapling isnt in either of those, then the planting behaviour should act as expected.

                                Edit: the reason hoe-ing the spot works is because it skips the "sapling placement allowed?" check for hoed dirt ;)
                                 
                                  Last edited: Apr 28, 2017
                                  MysticTempest likes this.
                                • MysticTempest

                                  MysticTempest Spaceman Spiff

                                  I just tested that out; setting all the MoreCrops Saplings to " -75", and it works perfectly! Thanks for all the help!
                                   

                                  Share This Page