How to modify a .json file permanently ?
Skyloq opened this issue · 21 comments
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:
- Modifie Pokemobs_.json ( with SublimeText3 in my case ) ( for example the name of a Pokemon )
- Save the modification
- Launch Minecraft ( With Pokecube )
- 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
ideally you should make a lang file for them, the ones in the database files are used internally, then translated for actual use ingame
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
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.
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
in pokecube.cfg, set debug to true, then start minecraft, then send the pokecube.log file it makes after minecraft goes off
I'm doing it right away
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)
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
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
I have try with the .json with two spawns and the launcher was stuck on
"Checking entries - Magnemite"
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
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?