@@ -30,33 +30,42 @@ public JsonObject parseJson(JsonObject entries, String fileName) {
3030 ore .addProperty ("enabled" , true );
3131
3232
33- JsonObject oreOut = new JsonObject ();
34-
35- copyOverSingleBlock (ore ,oreOut );
36- switch ( entries .get (ConfigNames .FILE_VERSION ).getAsString () ) {
37- case "1.2" :
38- ore .entrySet ().forEach ( prop -> oreOut .add (prop .getKey (), prop .getValue ()));
39- break ;
40- case "1.1" :
41- JsonArray biomes = ore .has (ConfigNames .BIOMES )?ore .getAsJsonArray (ConfigNames .BIOMES ):new JsonArray ();
42- JsonObject biomeObj = new JsonObject ();
43- biomeObj .add (biomes .size ()<1 ?ConfigNames .BiomeStuff .BLACKLIST :ConfigNames .BiomeStuff .WHITELIST , biomes );
44- oreOut .add ("biomes" , biomeObj );
45- oreOut .add ("biomes" , new JsonObject ());
46- oreOut .addProperty ("name" , getBlockName (ore ));
47- break ;
48- case "1" :
49- oreOut .add ("biomes" , new JsonObject ());
50- oreOut .addProperty ("name" , getBlockName (ore ));
51- break ;
52- default :
53- break ;
54- }
33+ JsonObject oreOut = handleVersionDifferences ( ore , entries .get (ConfigNames .FILE_VERSION ).getAsString () )
5534 dimData .add (oreOut );
5635 }
5736 retVal .getAsJsonObject ("dimensions" ).add (Integer .toString (dimension ), dimData );
5837 }
5938
6039 return retVal ;
61- }
40+ }
41+
42+ private JsonObject handleVersionDifferences ( JsonObject ore , String version ) {
43+ JsonObject returnValue = new JsonObject ();
44+
45+ if ( "1" .equals (version ) || "1.1" .equals (version ) ) {
46+ copyOverSingleBlock (ore , returnValue );
47+ }
48+
49+ switch ( version ) {
50+ case "1.2" :
51+ ore .entrySet ().forEach ( prop -> returnValue .add (prop .getKey (), prop .getValue ()));
52+ break ;
53+ case "1.1" :
54+ JsonArray biomes = ore .has (ConfigNames .BIOMES )?ore .getAsJsonArray (ConfigNames .BIOMES ):new JsonArray ();
55+ JsonObject biomeObj = new JsonObject ();
56+ biomeObj .add (biomes .size ()<1 ?ConfigNames .BiomeStuff .BLACKLIST :ConfigNames .BiomeStuff .WHITELIST , biomes );
57+ returnValue .add ("biomes" , biomeObj );
58+ returnValue .add ("biomes" , new JsonObject ());
59+ returnValue .addProperty ("name" , getBlockName (ore ));
60+ break ;
61+ case "1" :
62+ returnValue .add ("biomes" , new JsonObject ());
63+ returnValue .addProperty ("name" , getBlockName (ore ));
64+ break ;
65+ default :
66+ break ;
67+ }
68+ return returnValue ;
69+ }
70+
6271}
0 commit comments