Thutmose / Pokecube

Primary Development has moved to: https://github.com/Pokecube-Development
https://github.com/Pokecube-Development
19 stars 7 forks source link

How to modify a .json file permanently ? #289

Closed Skyloq closed 6 years ago

Skyloq commented 6 years ago

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"):

Thank you for reading

Thutmose commented 6 years ago

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

Skyloq commented 6 years ago

Thank You for your answer, i will try it now

Skyloq commented 6 years ago

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?

Thutmose commented 6 years ago

you need to send the crash report if your game crashed

Thutmose commented 6 years ago

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

Skyloq commented 6 years ago

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

Thutmose commented 6 years ago

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

Skyloq commented 6 years ago

pokecube.zip

I'm doing it right away

Skyloq commented 6 years ago

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)

Thutmose commented 6 years ago

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

Thutmose commented 6 years ago

get the crash report from the folder named crash-reports

Skyloq commented 6 years ago

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

Thutmose commented 6 years ago

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

Skyloq commented 6 years ago

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

Thutmose commented 6 years ago

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

Skyloq commented 6 years ago

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?

Thutmose commented 6 years ago

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

Thutmose commented 6 years ago

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

Thutmose commented 6 years ago

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.

Thutmose commented 6 years ago

the bug with this should be fixed in pokecube core 6.36.22

Skyloq commented 6 years ago

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