Sort biome weights json alphabetically

This commit is contained in:
Adubbz 2020-02-14 13:18:48 +11:00
parent 8fbe69e163
commit 15078fde5a
2 changed files with 11 additions and 13 deletions

View file

@ -13,14 +13,15 @@ import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.util.Map; import java.util.Map;
import java.util.TreeMap;
public class BiomeConfigData public class BiomeConfigData
{ {
@SerializedName("standard_weights") @SerializedName("standard_weights")
public Map<String, StandardBiomeEntry> standardBiomeWeights = Maps.newHashMap(); public TreeMap<String, StandardBiomeEntry> standardBiomeWeights = Maps.newTreeMap();
@SerializedName("sub_biome_weights") @SerializedName("sub_biome_weights")
public Map<String, SubBiomeEntry> subBiomeEntries = Maps.newHashMap(); public TreeMap<String, SubBiomeEntry> subBiomeEntries = Maps.newTreeMap();
//@SerializedName("island_biome_weights") //@SerializedName("island_biome_weights")
//public Map<String, IslandBiomeEntry> islandBiomeEntries = Maps.newHashMap(); //public Map<String, IslandBiomeEntry> islandBiomeEntries = Maps.newHashMap();

View file

@ -24,16 +24,11 @@ import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.system.CallbackI;
import java.io.File; import java.io.File;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
public class BiomeRegistry public class BiomeRegistry
@ -60,7 +55,7 @@ public class BiomeRegistry
public static void configureStandardBiomes() public static void configureStandardBiomes()
{ {
List<DeferredRegistration> standardRegistrations = deferrances.get(RegistrationType.STANDARD_BIOME); List<DeferredRegistration> standardRegistrations = deferrances.get(RegistrationType.STANDARD_BIOME);
Map<String, BiomeConfigData.StandardBiomeEntry> defaultEntries = Maps.newHashMap(); TreeMap<String, BiomeConfigData.StandardBiomeEntry> defaultEntries = Maps.newTreeMap();
Map<String, StandardBiomeRegistrationData> regDataMap = Maps.newHashMap(); Map<String, StandardBiomeRegistrationData> regDataMap = Maps.newHashMap();
for (DeferredRegistration<StandardBiomeRegistrationData> registration : standardRegistrations) for (DeferredRegistration<StandardBiomeRegistrationData> registration : standardRegistrations)
@ -77,11 +72,13 @@ public class BiomeRegistry
} }
} }
BiomesOPlenty.logger.info(defaultEntries.keySet());
BiomeConfigData defaultConfigData = new BiomeConfigData(); BiomeConfigData defaultConfigData = new BiomeConfigData();
defaultConfigData.standardBiomeWeights = defaultEntries; defaultConfigData.standardBiomeWeights = defaultEntries;
BiomeConfigData configData = getConfigData(defaultConfigData); BiomeConfigData configData = getConfigData(defaultConfigData);
Map<String, BiomeConfigData.StandardBiomeEntry> revisedStandardBiomeWeights = Maps.newHashMap(defaultEntries); TreeMap<String, BiomeConfigData.StandardBiomeEntry> revisedStandardBiomeWeights = Maps.newTreeMap(defaultEntries);
// Merge the config file with the default values // Merge the config file with the default values
for (Map.Entry<String, BiomeConfigData.StandardBiomeEntry> biomeEntry : configData.standardBiomeWeights.entrySet()) for (Map.Entry<String, BiomeConfigData.StandardBiomeEntry> biomeEntry : configData.standardBiomeWeights.entrySet())
@ -113,7 +110,7 @@ public class BiomeRegistry
public static void configureSubBiomes() public static void configureSubBiomes()
{ {
List<DeferredRegistration> subBiomeRegistrations = deferrances.get(RegistrationType.SUB_BIOME); List<DeferredRegistration> subBiomeRegistrations = deferrances.get(RegistrationType.SUB_BIOME);
Map<String, BiomeConfigData.SubBiomeEntry> defaultSubBiomeEntries = Maps.newHashMap(); TreeMap<String, BiomeConfigData.SubBiomeEntry> defaultSubBiomeEntries = Maps.newTreeMap();
Map<String, SubBiomeRegistrationData> regDataMap = Maps.newHashMap(); Map<String, SubBiomeRegistrationData> regDataMap = Maps.newHashMap();
for (DeferredRegistration<SubBiomeRegistrationData> registration : subBiomeRegistrations) for (DeferredRegistration<SubBiomeRegistrationData> registration : subBiomeRegistrations)
@ -128,7 +125,7 @@ public class BiomeRegistry
defaultConfigData.subBiomeEntries = defaultSubBiomeEntries; defaultConfigData.subBiomeEntries = defaultSubBiomeEntries;
BiomeConfigData configData = getConfigData(defaultConfigData); BiomeConfigData configData = getConfigData(defaultConfigData);
Map<String, BiomeConfigData.SubBiomeEntry> revisedSubBiomeEntries = Maps.newHashMap(defaultSubBiomeEntries); TreeMap<String, BiomeConfigData.SubBiomeEntry> revisedSubBiomeEntries = Maps.newTreeMap(defaultSubBiomeEntries);
// Merge the config file with the default values // Merge the config file with the default values
for (Map.Entry<String, BiomeConfigData.SubBiomeEntry> biomeEntry : configData.subBiomeEntries.entrySet()) for (Map.Entry<String, BiomeConfigData.SubBiomeEntry> biomeEntry : configData.subBiomeEntries.entrySet())
@ -162,7 +159,7 @@ public class BiomeRegistry
{ {
// Island biomes are currently not configurable due to them being registered multiple times for different climates // Island biomes are currently not configurable due to them being registered multiple times for different climates
// List<DeferredRegistration> islandBiomeReistrations = deferrances.get(RegistrationType.ISLAND_BIOME); // List<DeferredRegistration> islandBiomeReistrations = deferrances.get(RegistrationType.ISLAND_BIOME);
// Map<String, BiomeConfigData.IslandBiomeEntry> defaultIslandBiomeEntries = Maps.newHashMap(); // Map<String, BiomeConfigData.IslandBiomeEntry> defaultIslandBiomeEntries = Maps.newTreeMap();
// Map<String, IslandBiomeRegistrationData> regDataMap = Maps.newHashMap(); // Map<String, IslandBiomeRegistrationData> regDataMap = Maps.newHashMap();
// //
// for (DeferredRegistration<IslandBiomeRegistrationData> registration : islandBiomeReistrations) // for (DeferredRegistration<IslandBiomeRegistrationData> registration : islandBiomeReistrations)