Kakoen/valheim-save-tools

Java exception when converting json back to db

Closed this issue · 3 comments

My map seed didn't have the dragonqueen in it, so I extracted the .db file to json (670MB!), copied and pasted the Vendor_BlackForest entry and modified the coördinates for it. But now when I convert it back it throws this error:

INFO Reading from /mnt/c/Users/Pieter/worldjson.json
INFO Archive type: DB
INFO Saving DB to /mnt/c/Users/Pieter/worldnew.db
Exception in thread "main" java.lang.NullPointerException
        at net.kakoen.valheim.save.parser.ZPackage.writeString(ZPackage.java:342)
        at net.kakoen.valheim.save.archive.save.PrefabLocation.save(PrefabLocation.java:26)
        at net.kakoen.valheim.save.archive.save.Zones.lambda$save$0(Zones.java:67)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at net.kakoen.valheim.save.archive.save.Zones.save(Zones.java:67)
        at net.kakoen.valheim.save.archive.ValheimSaveArchive.writeZdos(ValheimSaveArchive.java:86)
        at net.kakoen.valheim.save.archive.ValheimSaveArchive.save(ValheimSaveArchive.java:66)
        at net.kakoen.valheim.save.SaveToolsCLI.saveArchive(SaveToolsCLI.java:77)
        at net.kakoen.valheim.save.SaveToolsCLI.main(SaveToolsCLI.java:56)

Any ideas on what I'm doing wrong or how I can put the dragonqueen in my world file?

Could it be that they are simply too close to each other?

    }, {
      "name" : "Vendor_BlackForest",
      "position" : {
        "x" : -1017.7126,
        "y" : 47.02371,
        "z" : -1220.2775
      },
      "generated" : true
    }, {    }, {
      "name" : "Dragonqueen",
      "position" : {
        "x" : -1012.7126,
        "y" : 46.02371,
        "z" : -1220.2775
      },
      "generated" : true
    },

@pieterhouwen Between the two entries, there's an empty object. Removing that should fix it.

Change

}, { }, {

to

}, {

Also note that the y coordinate is height. You probably want to modify x and z instead. If you want the summoning altar to spawn, set generated to false. This should make the game spawn the game objects related to the boss when you get near.

Hope that helps!

Hi Kakoen,

Removing the empty object seemed to do the trick as far as re-reading the json file and creating a new world db file.
However there was nothing being spawned at selected coördinates, I ended up cheating the moder into the game, saving it and publishing it back to my server.

Thanks for the help anyway :)