Pokécube Resources

Pokécube Resources

913 Downloads

How to modify a .json file permanently ?

Skyloq opened this issue · 21 comments

commented

What happens:

Hi, I would like to edit a file in .json (Pokemobs_.json) without it then be remodeled at the start of minecraft

What you expected to happen:

I was expecting the file not to be reworked at the minecraft startup

Steps to reproduce:

  1. Modifie Pokemobs_.json ( with SublimeText3 in my case ) ( for example the name of a Pokemon )
  2. Save the modification
  3. Launch Minecraft ( With Pokecube )
  4. Back to Pokemobs_.json and see that the file has been modified ( Bulbasaur -> Bulbizarre -> Bulbasaur )
    ...

Affected Versions (Do not use "latest"):

  • Pokecube Core: pokecube-core-1.12.2-6.36.12
  • Pokecube Revival (if applicable): pokecube-revival-1.12.2-6.14.19
  • Pokecube Mobs (if applicable): pokecube-mobs-1.12.2-4.9.0
  • Minecraft: 1.12.2
  • Forge: forge-1.12.2-14.23.3.2655

Thank you for reading

commented

ideally you should make a lang file for them, the ones in the database files are used internally, then translated for actual use ingame

commented

here is the lang file with the names:
https://github.com/Thutmose/Pokecube-Mobs/tree/master/src/main/resources/assets/pokecube_mobs/lang

if you make one for your language, you can submit a pull request (PR) and I will merge it, or you can just send me the file if you don't want to make a PR

commented

I have found the problem with the database files, it seems it was in https://github.com/Thutmose/Pokecube-Mobs, it will be fixed for next version of that uploaded

I will put the fix for this in pokecube core, I think I can get it in there.

commented

the bug with this should be fixed in pokecube core 6.36.22

commented

The default files are intended to reset each time, as they need to for any updates to the mods. You can disable this via the forgeDatabase config in pokecube.cfg, or, you can add new json databases instead, and then update those.

in pokecube.cfg, there is the following config:

    S:configDatabases <
        
        
        
     >

if you want to edit a database, say the spawns one, and you make a copy of the file, say called pokemob_spawns_new.json, then you can apply that ingame, by the following config

    S:configDatabases <
        pokemob_spawns_new
        
        
     >

and then it will load your pokemob_spawns_new.json after loading the default ones. this allows you to overwrite the existing ones

commented

Thank You for your answer, i will try it now

commented

I'm probably not very talented, so I'll explain in detail what I did so you could help me

In the first place, I wrote this line of code :
image

Then I create the copy of pokemobs_spawns.json
image

Finally, I have change "industrial" by "sandy"

image
image

Then my game crash :/

Can you tell me what I did wrong?

commented

you need to send the crash report if your game crashed

commented

also send the entire json you made, maybe something in it is formatted wrongly

commented

There is not... Minecraft goes off and that's all.
No return to the Launcher :/

But the loading stuck for several seconds at this time :

image

commented

in pokecube.cfg, set debug to true, then start minecraft, then send the pokecube.log file it makes after minecraft goes off

commented

pokecube.zip

I'm doing it right away

commented

The game crashed whilst there was a severe problem during mod loading that has caused the game to fail
Error: net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Pokecube Model Loader (pokecube_ml)

commented

get the crash report from the folder named crash-reports

commented

if you are only editing those two spawns, use this for the json instead:

{
  "pokemon": [
    {
      "name": "Magnemite",
      "stats": {
        "spawnRules": [
          {
            "values": {
              "types": "sandy",
              "rate": "0.7"
            }
          }
        ]
      }
    },
    {
      "name": "Voltorb",
      "stats": {
        "spawnRules": [
          {
            "values": {
              "types": "sandy",
              "rate": "0.7"
            }
          }
        ]
      }
    }
  ]
}

no need to include all the ones you didn't edit, it results in duplicate spawns for them

commented

hmm, I might need to look into the issues for this, in the mean time, try using the spawns.xml in config/pokecube/compat instead

commented

I have try with the .json with two spawns and the launcher was stuck on

"Checking entries - Magnemite"

crash-2018-05-18_00.32.30-client.txt

commented

ya,this looks like I need to fix something, in the mean time, use the spawns.xml in config/pokecube/compat and I will look into this one in the mean time

commented

spawns.xml works great, thanks! My problem is solved but I also planned to change the name of the pokemons (to translate them into the language of my country). You think it's possible to make an xml file (same type as spawns.xml) for that?

commented

Thank you very much, I will try make a pull request when translating finished, otherwise I'll send it to you