Search in sources :

Example 16 with BlockMeta

use of cavern.util.BlockMeta in project Cavern2 by kegare.

the class ConfigMiningPoints method init.

public void init() {
    Set<PointEntry> entries = Sets.newTreeSet();
    entries.add(new PointEntry("oreCoal", 1));
    entries.add(new PointEntry("oreIron", 1));
    entries.add(new PointEntry("oreGold", 1));
    entries.add(new PointEntry("oreRedstone", 2));
    entries.add(new PointEntry(new BlockMeta(Blocks.LIT_REDSTONE_ORE, 0), 2));
    entries.add(new PointEntry("oreLapis", 3));
    entries.add(new PointEntry("oreEmerald", 3));
    entries.add(new PointEntry("oreDiamond", 5));
    entries.add(new PointEntry("oreQuartz", 2));
    entries.add(new PointEntry("oreCopper", 1));
    entries.add(new PointEntry("oreTin", 1));
    entries.add(new PointEntry("oreLead", 1));
    entries.add(new PointEntry("oreSilver", 1));
    entries.add(new PointEntry("oreAdamantium", 1));
    entries.add(new PointEntry("oreAluminum", 1));
    entries.add(new PointEntry("oreApatite", 1));
    entries.add(new PointEntry("oreMythril", 1));
    entries.add(new PointEntry("oreOnyx", 1));
    entries.add(new PointEntry("oreUranium", 2));
    entries.add(new PointEntry("oreSapphire", 3));
    entries.add(new PointEntry("oreRuby", 3));
    entries.add(new PointEntry("oreTopaz", 2));
    entries.add(new PointEntry("oreChrome", 1));
    entries.add(new PointEntry("orePlatinum", 1));
    entries.add(new PointEntry("oreTitanium", 1));
    entries.add(new PointEntry("oreSulfur", 1));
    entries.add(new PointEntry("oreSaltpeter", 1));
    entries.add(new PointEntry("oreFirestone", 2));
    entries.add(new PointEntry("oreSalt", 1));
    entries.add(new PointEntry("oreJade", 1));
    entries.add(new PointEntry("oreManganese", 1));
    entries.add(new PointEntry("oreLanite", 1));
    entries.add(new PointEntry("oreMeurodite", 1));
    entries.add(new PointEntry("oreSoul", 1));
    entries.add(new PointEntry("oreSunstone", 1));
    entries.add(new PointEntry("oreZinc", 1));
    entries.add(new PointEntry("oreCrocoite", 3));
    entries.add(new PointEntry("glowstone", 2));
    entries.add(new PointEntry("oreGypsum", 1));
    entries.add(new PointEntry("oreChalcedonyB", 1));
    entries.add(new PointEntry("oreChalcedonyW", 1));
    entries.add(new PointEntry("oreMagnetite", 1));
    entries.add(new PointEntry("oreNiter", 1));
    entries.add(new PointEntry("oreSchorl", 1));
    entries.add(new PointEntry("oreCobalt", 1));
    entries.add(new PointEntry("oreArdite", 1));
    entries.add(new PointEntry("oreAquamarine", 2));
    entries.add(new PointEntry("oreMagnite", 1));
    entries.add(new PointEntry("oreRandomite", 2));
    entries.add(new PointEntry("oreHexcite", 4));
    entries.add(new PointEntry(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.FISSURED_STONE.getMetadata()), 3));
    ConfigCategory category = GeneralConfig.config.getCategory(Configuration.CATEGORY_GENERAL);
    Property prop = category.get("miningPoints");
    if (prop != null) {
        String[] data = entries.stream().filter(entry -> entry.isValid()).map(PointEntry::toString).toArray(String[]::new);
        prop.set(data);
        setValues(data);
    }
}
Also used : ConfigCategory(net.minecraftforge.common.config.ConfigCategory) BlockMeta(cavern.util.BlockMeta) Property(net.minecraftforge.common.config.Property)

Example 17 with BlockMeta

use of cavern.util.BlockMeta in project Cavern2 by kegare.

the class GuiSelectBlock method drawScreen.

@Override
public void drawScreen(int mouseX, int mouseY, float ticks) {
    blockList.drawScreen(mouseX, mouseY, ticks);
    boolean single = nameField != null || metaField != null;
    String name = null;
    if (single) {
        name = I18n.format(Config.LANG_KEY + "select.block");
    } else {
        name = I18n.format(Config.LANG_KEY + "select.block.multiple");
    }
    if (!Strings.isNullOrEmpty(name)) {
        drawCenteredString(fontRenderer, name, width / 2, 15, 0xFFFFFF);
    }
    super.drawScreen(mouseX, mouseY, ticks);
    filterTextField.drawTextBox();
    if (detailHoverChecker.checkHover(mouseX, mouseY)) {
        drawHoveringText(fontRenderer.listFormattedStringToWidth(I18n.format(Config.LANG_KEY + "detail.hover"), 300), mouseX, mouseY);
    } else if (instantHoverChecker.checkHover(mouseX, mouseY)) {
        drawHoveringText(fontRenderer.listFormattedStringToWidth(I18n.format(Config.LANG_KEY + "instant.hover"), 300), mouseX, mouseY);
    }
    if (!single && !blockList.selected.isEmpty()) {
        if (mouseX <= 100 && mouseY <= 20) {
            drawString(fontRenderer, I18n.format(Config.LANG_KEY + "select.block.selected", blockList.selected.size()), 5, 5, 0xEFEFEF);
        }
        if (selectedHoverChecker.checkHover(mouseX, mouseY)) {
            List<String> texts = Lists.newArrayList();
            for (BlockMeta blockMeta : blockList.selected) {
                name = blockList.getBlockName(blockMeta);
                if (!Strings.isNullOrEmpty(name)) {
                    texts.add(name);
                }
            }
            drawHoveringText(texts, mouseX, mouseY);
        }
    }
}
Also used : BlockMeta(cavern.util.BlockMeta)

Example 18 with BlockMeta

use of cavern.util.BlockMeta in project Cavern2 by kegare.

the class CavernConfig method addVeinsFromConfig.

public static boolean addVeinsFromConfig(CaveVeinManager manager) {
    boolean flag = false;
    for (String name : manager.config.getCategoryNames()) {
        if (NumberUtils.isCreatable(name)) {
            try {
                ConfigCategory category = manager.config.getCategory(name);
                String block = category.get("block").getString();
                String blockMeta = category.get("blockMeta").getString();
                String targetBlock = category.get("targetBlock").getString();
                String targetBlockMeta = category.get("targetBlockMeta").getString();
                int weight = category.get("weight").getInt();
                double chance = category.get("chance").getDouble();
                int size = category.get("size").getInt();
                int minHeight = category.get("minHeight").getInt();
                int maxHeight = category.get("maxHeight").getInt();
                String[] biomes = category.get("biomes").getStringList();
                CaveVein vein = new CaveVein();
                vein.setBlockMeta(new BlockMeta(block, blockMeta));
                vein.setTarget(new BlockMeta(targetBlock, targetBlockMeta));
                vein.setWeight(weight);
                vein.setChance(chance);
                vein.setSize(size);
                vein.setMinHeight(minHeight);
                vein.setMaxHeight(maxHeight);
                vein.setBiomes(biomes);
                manager.addCaveVein(vein);
            } catch (Exception e) {
            }
        } else {
            flag = true;
        }
    }
    return flag;
}
Also used : ConfigCategory(net.minecraftforge.common.config.ConfigCategory) BlockMeta(cavern.util.BlockMeta) CaveVein(cavern.config.manager.CaveVein)

Example 19 with BlockMeta

use of cavern.util.BlockMeta in project Cavern2 by kegare.

the class HugeCavernConfig method syncVeinsConfig.

public static void syncVeinsConfig() {
    if (veinManager.config == null) {
        veinManager.config = Config.loadConfig("hugecavern", "veins");
    } else {
        veinManager.getCaveVeins().clear();
    }
    if (veinManager.config.getCategoryNames().isEmpty()) {
        List<CaveVein> veins = Lists.newArrayList();
        veins.add(new CaveVein(new BlockMeta(Blocks.STONE, BlockStone.EnumType.GRANITE.getMetadata()), 15, 25, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.STONE, BlockStone.EnumType.GRANITE.getMetadata()), 28, 25, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.STONE, BlockStone.EnumType.DIORITE.getMetadata()), 15, 25, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.STONE, BlockStone.EnumType.DIORITE.getMetadata()), 28, 25, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.STONE, BlockStone.EnumType.ANDESITE.getMetadata()), 18, 25, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.STONE, BlockStone.EnumType.ANDESITE.getMetadata()), 30, 25, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.COAL_ORE, 0), 30, 17, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.COAL_ORE, 0), 55, 17, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.IRON_ORE, 0), 35, 10, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.IRON_ORE, 0), 60, 10, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.GOLD_ORE, 0), 5, 5, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.GOLD_ORE, 0), 10, 5, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.REDSTONE_ORE, 0), 8, 6, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.REDSTONE_ORE, 0), 20, 6, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.LAPIS_ORE, 0), 10, 5, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.LAPIS_ORE, 0), 22, 5, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.DIAMOND_ORE, 0), 2, 5, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.DIAMOND_ORE, 0), 4, 5, 50, 255));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.AQUAMARINE_ORE.getMetadata()), 10, 8, 1, 50, Type.COLD, Type.WATER, Type.WET));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.AQUAMARINE_ORE.getMetadata()), 12, 8, 50, 255, Type.COLD, Type.WATER, Type.WET));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.MAGNITE_ORE.getMetadata()), 30, 10, 1, 50));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.MAGNITE_ORE.getMetadata()), 50, 10, 50, 255));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.RANDOMITE_ORE.getMetadata()), 15, 4, 1, 50));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.RANDOMITE_ORE.getMetadata()), 24, 4, 50, 255));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.HEXCITE_ORE.getMetadata()), 2, 5, 1, 50));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.HEXCITE_ORE.getMetadata()), 4, 5, 50, 255));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.FISSURED_STONE.getMetadata()), 40, 2, 1, 50));
        veins.add(new CaveVein(new BlockMeta(CaveBlocks.CAVE_BLOCK, BlockCave.EnumType.FISSURED_STONE.getMetadata()), 80, 2, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.DIRT, 0), 16, 25, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.DIRT, 0), 20, 25, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.GRAVEL, 0), 8, 20, 1, 50));
        veins.add(new CaveVein(new BlockMeta(Blocks.GRAVEL, 0), 10, 20, 50, 255));
        veins.add(new CaveVein(new BlockMeta(Blocks.SAND, BlockSand.EnumType.SAND.getMetadata()), 8, 20, 1, 50, Type.SANDY));
        veins.add(new CaveVein(new BlockMeta(Blocks.SAND, BlockSand.EnumType.SAND.getMetadata()), 10, 20, 50, 255, Type.SANDY));
        CavernConfig.generateVeinsConfig(veinManager, veins);
    } else {
        if (CavernConfig.addVeinsFromConfig(veinManager)) {
            try {
                FileUtils.forceDelete(new File(veinManager.config.toString()));
                veinManager.getCaveVeins().clear();
                veinManager.config = null;
                syncVeinsConfig();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    Config.saveConfig(veinManager.config);
}
Also used : BlockMeta(cavern.util.BlockMeta) File(java.io.File) CaveVein(cavern.config.manager.CaveVein)

Example 20 with BlockMeta

use of cavern.util.BlockMeta 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

BlockMeta (cavern.util.BlockMeta)21 CaveVein (cavern.config.manager.CaveVein)7 File (java.io.File)7 CaveBiome (cavern.config.manager.CaveBiome)5 Biome (net.minecraft.world.biome.Biome)4 Block (net.minecraft.block.Block)3 IBlockState (net.minecraft.block.state.IBlockState)3 ItemStack (net.minecraft.item.ItemStack)3 Strings (com.google.common.base.Strings)2 Sets (com.google.common.collect.Sets)2 IOException (java.io.IOException)2 List (java.util.List)2 Set (java.util.Set)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 ConfigCategory (net.minecraftforge.common.config.ConfigCategory)2 IIceEquipment (cavern.api.IIceEquipment)1 IMinerStats (cavern.api.IMinerStats)1 IMiningData (cavern.api.IMiningData)1 CaveConfigGui (cavern.client.config.CaveConfigGui)1