Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mysticsbiomes.config;
- import com.electronwill.nightconfig.core.CommentedConfig;
- import com.electronwill.nightconfig.core.io.WritingMode;
- import com.electronwill.nightconfig.toml.TomlFormat;
- import com.mysticsbiomes.MysticsBiomes;
- import net.fabricmc.loader.api.FabricLoader;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.util.*;
- public class MysticConfig {
- public static final MysticConfig INSTANCE = new MysticConfig();
- private static final Path PATH = FabricLoader.getInstance().getConfigDir().resolve(MysticsBiomes.modId + "-common.toml");
- private CommentedConfig config;
- public static ConfigEntry<Integer> biomeRegionWeight;
- public static ConfigEntry<Boolean> enableExperimentalBiomeGen;
- public static ConfigEntry<Boolean> enableStrawberryFields;
- public static ConfigEntry<Boolean> enableLavenderMeadow;
- public static ConfigEntry<Boolean> enableBambooBlossomForest;
- public static ConfigEntry<Boolean> enableAutumnalGrove;
- public static ConfigEntry<Boolean> enableLushOasis;
- public static ConfigEntry<Boolean> enableLagoon;
- public static ConfigEntry<Boolean> enableTropics;
- public static ConfigEntry<List<String>> strawberryFieldsBiomeSpawns;
- public static ConfigEntry<List<String>> lavenderMeadowBiomeSpawns;
- public static ConfigEntry<List<String>> bambooBlossomForestBiomeSpawns;
- public static ConfigEntry<List<String>> autumnalGroveBiomeSpawns;
- public static ConfigEntry<List<String>> lushOasisBiomeSpawns;
- public static ConfigEntry<List<String>> lagoonBiomeSpawns;
- public static ConfigEntry<List<String>> tropicsBiomeSpawns;
- public static ConfigEntry<List<String>> rainbowChickenBiomeSpawns;
- public static ConfigEntry<Integer> rainbowChickenSpawnChance;
- private MysticConfig() {
- this.config = TomlFormat.instance().createConfig();
- }
- public void init() {
- if (Files.exists(PATH)) {
- try {
- String content = Files.readString(PATH);
- this.config = TomlFormat.instance().createParser().parse(content);
- } catch (Exception e) {
- MysticsBiomes.logger.warn("Failed to read config file, using defaults.", e);
- this.config = TomlFormat.instance().createConfig();
- }
- } else {
- this.config = TomlFormat.instance().createConfig();
- }
- this.loadDefaults();
- this.write();
- }
- private void loadDefaults() {
- biomeRegionWeight = this.build("biome_gen.biome_region_weight", "The higher the number, the more common the biomes will be.\nDefault: 6", 6);
- enableExperimentalBiomeGen = this.build("biome_gen.enable_experimental_biome_gen", "Uses the method Biomes O' Plenty uses for generating biomes.\nNot personally recommended but feel free to try it out.", false);
- enableStrawberryFields = this.build("biome_toggles.enable_strawberry_fields", "Determine if a biome will generate or not.", true);
- enableLavenderMeadow = this.build("biome_toggles.enable_lavender_meadow", true);
- enableBambooBlossomForest = this.build("biome_toggles.enable_bamboo_blossom_forest", true);
- enableAutumnalGrove = this.build("biome_toggles.enable_autumnal_grove", true);
- enableLushOasis = this.build("biome_toggles.enable_lush_oasis", true);
- enableLagoon = this.build("biome_toggles.enable_lagoon", true);
- enableTropics = this.build("biome_toggles.enable_tropics", true);
- strawberryFieldsBiomeSpawns = this.build("biome_spawns.strawberry_fields_spawns", "List of the biomes each biome can replace.\nWhatever biomes are listed, the given biome will have a chance to spawn in place of that biome.\nDefault: minecraft:sunflower_plains", List.of("minecraft:sunflower_plains"));
- lavenderMeadowBiomeSpawns = this.build("biome_spawns.lavender_meadow_spawns", List.of("minecraft:meadow"));
- bambooBlossomForestBiomeSpawns = this.build("biome_spawns.bamboo_blossom_forest_spawns", "Default: minecraft:snowy_taiga", List.of("minecraft:snowy_taiga"));
- autumnalGroveBiomeSpawns = this.build("biome_spawns.autumnal_grove_spawns", "Default: minecraft:taiga", List.of("minecraft:taiga"));
- lushOasisBiomeSpawns = this.build("biome_spawns.lush_oasis_spawns", "Default: minecraft:desert", List.of("minecraft:desert"));
- lagoonBiomeSpawns = this.build("biome_spawns.lagoon_spawns", "Default: minecraft:beach", List.of("minecraft:beach"));
- tropicsBiomeSpawns = this.build("biome_spawns.tropics_spawns", "Default: minecraft:jungle", List.of("minecraft:jungle"));
- rainbowChickenBiomeSpawns = this.build("animal_spawns.rainbow_chicken_biome_spawns", "Biomes an animal can spawn in.\nValues can include modded biomes and biome tags. (i.e. \"mysticsbiomes:strawberry_fields\")", biomes("minecraft:plains", "minecraft:forest", "minecraft:flower_forest"));
- rainbowChickenSpawnChance = this.build("rainbow_chicken_spawn_chance", "The chance an animal will spawn.\nThe higher the number, the more common the animal will spawn.", 22);
- }
- private static List<String> biomes(String... biomes) {
- return new ArrayList<>(Arrays.asList(biomes));
- }
- public void write() {
- try {
- TomlFormat.instance().createWriter().write(config, PATH, WritingMode.REPLACE);
- } catch (Exception e) {
- MysticsBiomes.logger.error("Failed to write config file", e);
- }
- }
- private <T> ConfigEntry<T> build(String key, T defaultValue) {
- return this.build(key, "" , defaultValue);
- }
- private <T> ConfigEntry<T> build(String key, String comment, T defaultValue) {
- T value = this.config.getOrElse(key, defaultValue);
- this.config.set(key, value);
- if (!comment.isEmpty()) {
- this.config.setComment(key, comment);
- }
- return new ConfigEntry<>(value);
- }
- public static class ConfigEntry<T> {
- private T value;
- public ConfigEntry(T value) {
- this.value = value;
- }
- public T get() {
- return value;
- }
- public void set(T value) {
- this.value = value;
- }
- }
- }
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=fzymcqsrft
- This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
- The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
- Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment