assetManager loading custom files


I’m currently facing an issue who i don’t have any idea on how to solve it, this one come from the way i’m handling the loading of the map on the current project i’m working on, as it pretty hard to explain i’ll show some picture.

When the game start and load the map for the first time i got this as a “starter” :

Then i press the load button to load another map, it give me this :

So far nothing weird it work as expected, so i change one tile of the map and i got this :

Still nothing weird, but if i press the “reset” button and then press the “load” button again, the map it give me as a result is the 3rd image where it should be 2nd image. (The reset button load the result of the 1rst image and work as expected). I can redo the same operation multiple time it will have the same behaviour.

To load a map, i’m reading a file an extract data from it to generate the map, the first time as show, work properly but after that, it didn’t, it’s like it didn’t read the file, since if i close and reload the game it load the file correctly. I’m suspecting the memory to didn’t do what i expect but i dono on wich level since i’m not that good on these stuff in java… it could come from how jme assetManager work on too since for me it’s like java i dono how it realy handle the memory/loading stuff etc… One thing is sure, there is something i’m not doing right ^^

Here is the code used to make my register for the assetManager :
[java]String userHome = System.getProperty(“user.dir”) + “/assets/MapData/”;
// System.out.println(userHome);
assetManager.registerLocator(userHome, ChunkDataLoader.class);
assetManager.registerLoader(ChunkDataLoader.class, “chk”);
assetManager.registerLocator(userHome, MapDataLoader.class);
assetManager.registerLoader(MapDataLoader.class, “map”); [/java]

Here is the code used to load the map :
[java]public void loadMap(String name) {
MapDataLoader mdLoader = (MapDataLoader) assetManager.loadAsset(new AssetKey(“MapData/”+name + “/” + name +".map"));
this.mapName = mdLoader.getMapName();
this.mapElement = mdLoader.getMapElement();
this.chunkPos = mdLoader.getChunkPos();
chunkEvent(new ChunkChangeEvent(true));
for(byte i = 0; i < chunkPos.size(); i++){
chunkEvent(new ChunkChangeEvent(chunkPos.get(i)));

private void loadChunk(Vector2Int position, String folder) {
String chunkPath;
if(folder == null){
chunkPath = “/MapData/Temp/” + position.toString() + “.chk”;
} else {
chunkPath = “/MapData/”+ folder+ “/” + position.toString() + “.chk”;
File file = new File(System.getProperty(“user.dir”) + “/assets” + chunkPath);
if(file.exists() && !file.isDirectory()){
ChunkDataLoader cdLoaded = (ChunkDataLoader) assetManager.loadAsset(new AssetKey(chunkPath));
chunkData.add(position, cdLoaded.getTiles());
} else {
System.err.println(chunkPath + " can’t be load, missing data.");
} [/java]

MapDataLoader and ChunkDataLoader class can be found on the git of the project as long with the other script there :
MapDataLoader and ChunkDataLoader

Thx for the help, and sorry for the double post, i’ve did a miss clic ^^