diff --git a/gradle.properties b/gradle.properties index 74e7517..45876f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ yarn_mappings=1.16.5+build.5 loader_version=0.11.2 # Mod Properties -mod_version=1.0.2 +mod_version=1.0.3 maven_group=draylar archives_base_name=omega-config diff --git a/omega-config-base/src/main/java/draylar/omegaconfig/OmegaConfig.java b/omega-config-base/src/main/java/draylar/omegaconfig/OmegaConfig.java index f44aa89..8bd775f 100644 --- a/omega-config-base/src/main/java/draylar/omegaconfig/OmegaConfig.java +++ b/omega-config-base/src/main/java/draylar/omegaconfig/OmegaConfig.java @@ -103,7 +103,7 @@ public static void writeConfig(Class configClass, T inst // Cursed time. List lines = new ArrayList<>(Arrays.asList(json.split("\n"))); - Map insertions = new HashMap<>(); + Map insertions = new TreeMap<>(); Map keyToComments = new HashMap<>(); // populate key -> comments map @@ -136,7 +136,11 @@ public static void writeConfig(Class configClass, T inst } // insertions -> list - insertions.forEach(lines::add); + for (Map.Entry entry : insertions.entrySet()) { + Integer key = entry.getKey(); + String value = entry.getValue(); + lines.add(key, value); + } // list -> string StringBuilder res = new StringBuilder(); diff --git a/src/testmod/java/draylar/omegatest/NewTestConfig.java b/src/testmod/java/draylar/omegatest/NewTestConfig.java new file mode 100644 index 0000000..f77eaef --- /dev/null +++ b/src/testmod/java/draylar/omegatest/NewTestConfig.java @@ -0,0 +1,126 @@ +package draylar.omegatest; + +import draylar.omegaconfig.api.Comment; +import draylar.omegaconfig.api.Config; + +public class NewTestConfig implements Config { + @Comment("Mo' Structures feature toggles.") + public Features features = new Features(); + + @Comment("Chances are once per the number of chunks. A Chance 500 makes a feature spawn every 500 chunks. Affected by biomes it spawns in and the chunk, so not all are proportional.") + public FeatureChances feature_chances = new FeatureChances(); + + @Comment("Structure toggles. These do not have chances, but in the future they may. ") + public Structures structures = new Structures(); + + @Comment("Structure chances. Seperation is the least amount of chunks that a structure will spawn from itself. Spacing is the maximum amount of chunks, and both are used to randomly spawn structures and can be tweaked.") + public StructureChances structureChances = new StructureChances(); + + @Override + public String getName() { + return "mostructures-config-v2"; + } + + public static class Features { + @Comment("Airplanes & Air Balloons") + public boolean air_features = true; + @Comment("Fallen Trees") + public boolean fallen_trees = true; + @Comment("Desert Features") + public boolean desert_features = true; + @Comment("Ruins") + public boolean ruins = true; + @Comment("Lamppost") + public boolean lamppost = true; + @Comment("Boulder") + public boolean boulder = true; + @Comment("Volcanic Vent") + public boolean volcanic_vent = true; + @Comment("Beach Features") + public boolean beach_features = true; + @Comment("Boats") + public boolean boats = true; + } + + public static class FeatureChances { + @Comment("Airplanes & Air Balloons") + public int air_feature_chance = 4600; + @Comment("Fallen Trees") + public int fallen_trees_chance = 17; + @Comment("Desert Features") + public int desert_features_chance = 555; + @Comment("Ruins") + public int ruins_chance = 3500; + @Comment("Lamppost") + public int lamppost_chance = 100; + @Comment("Boulder") + public int boulder_chance = 4000; + @Comment("Volcanic Vent") + public int volcanic_vent_chance = 85; + @Comment("Beach Features") + public int beach_features_chance = 75; + @Comment("Boats") + public int boats_chance = 4000; + } + + public static class Structures { + @Comment("Barnhouse") + public boolean barn_house = true; + @Comment("Jungle Pyramid") + public boolean jungle_pyramid = true; + @Comment("Big Pyramid") + public boolean big_pyramid = true; + @Comment("The Castle In The Sky") + public boolean the_castle_in_the_sky = true; + @Comment("Villager Tower") + public boolean villager_tower = true; + @Comment("Abandoned Churches") + public boolean abandoned_churches = true; + @Comment("Villager Market") + public boolean villager_market = true; + @Comment("Pillager Factory") + public boolean pillager_factory = true; + @Comment("Ice Tower") + public boolean ice_tower = true; + @Comment("Boar Hat Tavern") + public boolean tavern = true; + @Comment("Killer Bunny Castle") + public boolean killer_bunny_castle = true; + } + + public static class StructureChances { + @Comment("Barn House") + public int barn_house_seperation = 16; + public int barn_house_spacing = 40; + @Comment("Big Pyramid") + public int big_pyramid_seperation = 5; + public int big_pyramid_spacing = 25; + @Comment("Jungle Pyramid") + public int jungle_pyramid_seperation = 5; + public int jungle_pyramid_spacing = 25; + @Comment("The Castle In The Sky") + public int the_castle_in_the_sky_seperation = 8; + public int the_castle_in_the_sky_spacing = 32; + @Comment("Villager Tower") + public int villager_tower_seperation = 16; + public int villager_tower_spacing = 40; + @Comment("Abandoned Church") + public int abandoned_church_seperation = 16; + public int abandoned_church_spacing = 40; + @Comment("Villager Market") + public int villager_market_seperation = 27; + public int villager_market_spacing = 50; + @Comment("Pillager Factory") + public int pillager_factory_seperation = 27; + public int pillager_factory_spacing = 50; + @Comment("Ice Tower") + public int ice_tower_seperation = 8; + public int ice_tower_spacing = 32; + @Comment("Boar Hat Tavern") + public int tavern_seperation = 16; + public int tavern_spacing = 46; + @Comment("Killer Bunny Castle") + public int killer_bunny_castle_seperation = 25; + public int killer_bunny_castle_spacing = 50; + } +} \ No newline at end of file diff --git a/src/testmod/java/draylar/omegatest/OmegaTestMain.java b/src/testmod/java/draylar/omegatest/OmegaTestMain.java index 8f00971..81ca64f 100644 --- a/src/testmod/java/draylar/omegatest/OmegaTestMain.java +++ b/src/testmod/java/draylar/omegatest/OmegaTestMain.java @@ -6,6 +6,7 @@ public class OmegaTestMain implements ModInitializer { public static final TestConfig CONFIG = OmegaConfig.register(TestConfig.class); + public static final NewTestConfig MO_CONFIG = OmegaConfig.register(NewTestConfig.class); @Override public void onInitialize() {