Search in sources :

Example 6 with CaveBiome

use of cavern.config.manager.CaveBiome in project Cavern2 by kegare.

the class CavernConfig method addBiomesFromConfig.

public static void addBiomesFromConfig(CaveBiomeManager manager) {
    for (String name : manager.config.getCategoryNames()) {
        Biome biome = Config.getBiomeFromString(name);
        if (biome == null) {
            continue;
        }
        ConfigCategory category = manager.config.getCategory(name);
        int weight = category.get("weight").getInt();
        String terrainBlock = category.get("terrainBlock").getString();
        String terrainBlockMeta = category.get("terrainBlockMeta").getString();
        String topBlock = category.get("topBlock").getString();
        String topBlockMeta = category.get("topBlockMeta").getString();
        CaveBiome caveBiome = new CaveBiome(biome, weight);
        caveBiome.setTerrainBlock(new BlockMeta(terrainBlock, terrainBlockMeta));
        caveBiome.setTopBlock(new BlockMeta(topBlock, topBlockMeta));
        manager.addCaveBiome(caveBiome);
    }
}
Also used : CaveBiome(cavern.config.manager.CaveBiome) Biome(net.minecraft.world.biome.Biome) CaveBiome(cavern.config.manager.CaveBiome) ConfigCategory(net.minecraftforge.common.config.ConfigCategory) BlockMeta(cavern.util.BlockMeta)

Example 7 with CaveBiome

use of cavern.config.manager.CaveBiome in project Cavern2 by kegare.

the class CaveniaConfig method syncBiomesConfig.

public static void syncBiomesConfig() {
    if (biomeManager.config == null) {
        biomeManager.config = Config.loadConfig("cavenia", "biomes");
    } else {
        biomeManager.getCaveBiomes().clear();
    }
    if (biomeManager.config.getCategoryNames().isEmpty()) {
        List<CaveBiome> biomes = Lists.newArrayList();
        biomes.add(new CaveBiome(Biomes.OCEAN, 15, null, new BlockMeta(Blocks.GRAVEL.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.PLAINS, 100, null, new BlockMeta(Blocks.GRASS.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.DESERT, 70, null, new BlockMeta(Blocks.SAND.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.DESERT_HILLS, 10, null, new BlockMeta(Blocks.SANDSTONE.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.FOREST, 80, null, new BlockMeta(Blocks.GRAVEL.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.FOREST_HILLS, 10, null, new BlockMeta(Blocks.GRAVEL.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.TAIGA, 80));
        biomes.add(new CaveBiome(Biomes.TAIGA_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.JUNGLE, 80, null, new BlockMeta(Blocks.GRAVEL.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.JUNGLE_HILLS, 10, null, new BlockMeta(Blocks.GRAVEL.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.SWAMPLAND, 60, null, new BlockMeta(Blocks.GRASS.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.EXTREME_HILLS, 50));
        biomes.add(new CaveBiome(Biomes.SAVANNA, 50, null, new BlockMeta(Blocks.GRASS.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.MESA, 50, null, new BlockMeta(Blocks.RED_SANDSTONE.getDefaultState())));
        CavernConfig.generateBiomesConfig(biomeManager, biomes);
    } else {
        CavernConfig.addBiomesFromConfig(biomeManager);
    }
    Config.saveConfig(biomeManager.config);
}
Also used : CaveBiome(cavern.config.manager.CaveBiome) BlockMeta(cavern.util.BlockMeta)

Example 8 with CaveBiome

use of cavern.config.manager.CaveBiome in project Cavern2 by kegare.

the class CavernConfig method syncBiomesConfig.

public static void syncBiomesConfig() {
    if (biomeManager.config == null) {
        biomeManager.config = Config.loadConfig("cavern", "biomes");
    } else {
        biomeManager.getCaveBiomes().clear();
    }
    if (biomeManager.config.getCategoryNames().isEmpty()) {
        List<CaveBiome> biomes = Lists.newArrayList();
        biomes.add(new CaveBiome(Biomes.OCEAN, 15));
        biomes.add(new CaveBiome(Biomes.PLAINS, 100));
        biomes.add(new CaveBiome(Biomes.DESERT, 70));
        biomes.add(new CaveBiome(Biomes.DESERT_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.FOREST, 80));
        biomes.add(new CaveBiome(Biomes.FOREST_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.TAIGA, 80));
        biomes.add(new CaveBiome(Biomes.TAIGA_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.JUNGLE, 80));
        biomes.add(new CaveBiome(Biomes.JUNGLE_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.SWAMPLAND, 60));
        biomes.add(new CaveBiome(Biomes.EXTREME_HILLS, 50));
        biomes.add(new CaveBiome(Biomes.SAVANNA, 50));
        biomes.add(new CaveBiome(Biomes.MESA, 50));
        generateBiomesConfig(biomeManager, biomes);
    } else {
        addBiomesFromConfig(biomeManager);
    }
    Config.saveConfig(biomeManager.config);
}
Also used : CaveBiome(cavern.config.manager.CaveBiome)

Example 9 with CaveBiome

use of cavern.config.manager.CaveBiome in project Cavern2 by kegare.

the class CavernConfig method generateBiomesConfig.

public static void generateBiomesConfig(CaveBiomeManager manager, Collection<CaveBiome> biomes) {
    String category = "biomes";
    Property prop;
    String comment;
    for (CaveBiome caveBiome : biomes) {
        Biome biome = caveBiome.getBiome();
        String entry = biome.getRegistryName().toString();
        List<String> propOrder = Lists.newArrayList();
        prop = manager.config.get(entry, "weight", 0);
        prop.setMinValue(0).setMaxValue(100);
        prop.setLanguageKey(Config.LANG_KEY + category + "." + prop.getName());
        comment = Cavern.proxy.translate(prop.getLanguageKey() + ".tooltip");
        comment += " [range: " + prop.getMinValue() + " ~ " + prop.getMaxValue() + "]";
        prop.setComment(comment);
        propOrder.add(prop.getName());
        prop.set(caveBiome.getWeight());
        prop = manager.config.get(entry, "terrainBlock", biome.fillerBlock.getBlock().getRegistryName().toString());
        prop.setLanguageKey(Config.LANG_KEY + category + "." + prop.getName());
        comment = Cavern.proxy.translate(prop.getLanguageKey() + ".tooltip");
        prop.setComment(comment);
        propOrder.add(prop.getName());
        prop.set(caveBiome.getTerrainBlock().getBlockName());
        prop = manager.config.get(entry, "terrainBlockMeta", Integer.toString(biome.fillerBlock.getBlock().getMetaFromState(biome.fillerBlock)));
        prop.setLanguageKey(Config.LANG_KEY + category + "." + prop.getName());
        comment = Cavern.proxy.translate(prop.getLanguageKey() + ".tooltip");
        prop.setComment(comment);
        propOrder.add(prop.getName());
        prop.set(caveBiome.getTerrainBlock().getMetaString());
        prop = manager.config.get(entry, "topBlock", biome.topBlock.getBlock().getRegistryName().toString());
        prop.setLanguageKey(Config.LANG_KEY + category + "." + prop.getName());
        comment = Cavern.proxy.translate(prop.getLanguageKey() + ".tooltip");
        prop.setComment(comment);
        propOrder.add(prop.getName());
        prop.set(caveBiome.getTopBlock().getBlockName());
        prop = manager.config.get(entry, "topBlockMeta", Integer.toString(biome.topBlock.getBlock().getMetaFromState(biome.topBlock)));
        prop.setLanguageKey(Config.LANG_KEY + category + "." + prop.getName());
        comment = Cavern.proxy.translate(prop.getLanguageKey() + ".tooltip");
        prop.setComment(comment);
        propOrder.add(prop.getName());
        prop.set(caveBiome.getTopBlock().getMetaString());
        manager.config.setCategoryPropertyOrder(entry, propOrder);
        manager.addCaveBiome(caveBiome);
    }
}
Also used : CaveBiome(cavern.config.manager.CaveBiome) Biome(net.minecraft.world.biome.Biome) CaveBiome(cavern.config.manager.CaveBiome) Property(net.minecraftforge.common.config.Property)

Example 10 with CaveBiome

use of cavern.config.manager.CaveBiome in project Cavern2 by kegare.

the class HugeCavernConfig method syncBiomesConfig.

public static void syncBiomesConfig() {
    if (biomeManager.config == null) {
        biomeManager.config = Config.loadConfig("hugecavern", "biomes");
    } else {
        biomeManager.getCaveBiomes().clear();
    }
    if (biomeManager.config.getCategoryNames().isEmpty()) {
        List<CaveBiome> biomes = Lists.newArrayList();
        biomes.add(new CaveBiome(Biomes.OCEAN, 15));
        biomes.add(new CaveBiome(Biomes.PLAINS, 100));
        biomes.add(new CaveBiome(Biomes.DESERT, 70));
        biomes.add(new CaveBiome(Biomes.DESERT_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.FOREST, 80));
        biomes.add(new CaveBiome(Biomes.FOREST_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.TAIGA, 80));
        biomes.add(new CaveBiome(Biomes.TAIGA_HILLS, 10));
        biomes.add(new CaveBiome(Biomes.JUNGLE, 80, null, new BlockMeta(Blocks.GRAVEL.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.JUNGLE_HILLS, 10, null, new BlockMeta(Blocks.GRAVEL.getDefaultState())));
        biomes.add(new CaveBiome(Biomes.SWAMPLAND, 60));
        biomes.add(new CaveBiome(Biomes.EXTREME_HILLS, 50));
        biomes.add(new CaveBiome(Biomes.SAVANNA, 50));
        biomes.add(new CaveBiome(Biomes.MESA, 50, null, new BlockMeta(Blocks.RED_SANDSTONE.getDefaultState())));
        CavernConfig.generateBiomesConfig(biomeManager, biomes);
    } else {
        CavernConfig.addBiomesFromConfig(biomeManager);
    }
    Config.saveConfig(biomeManager.config);
}
Also used : CaveBiome(cavern.config.manager.CaveBiome) BlockMeta(cavern.util.BlockMeta)

Aggregations

CaveBiome (cavern.config.manager.CaveBiome)12 Biome (net.minecraft.world.biome.Biome)7 BlockMeta (cavern.util.BlockMeta)5 IBlockState (net.minecraft.block.state.IBlockState)4 List (java.util.List)2 File (java.io.File)1 IOException (java.io.IOException)1 Block (net.minecraft.block.Block)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1 ConfigCategory (net.minecraftforge.common.config.ConfigCategory)1 Property (net.minecraftforge.common.config.Property)1