Package net.minecraftforge.common.config

Examples of net.minecraftforge.common.config.Configuration$UnicodeInputStreamReader


public class SocialRegistry {

  public static void initialize() {

    friendConf = new Configuration(new File(CoFHProps.configDir, "/cofh/CoFHSocial-Friends.cfg"));
    friendConf.load();
  }
View Full Code Here


    public final static String CATEGORY_BLOCK = "ores.block_";

    public void loadConfig(File file) {

        Configuration config = new Configuration(file);

        config.load();

        DenseOresRegistry.initVanillaOres();

        // 'get' the vanilla ore entries to ensure that they exist
        for (DenseOre ore : DenseOresRegistry.ores.values()) {

            String cat = CATEGORY_BLOCK + ore.id;

            config.get(cat, "baseBlock", ore.baseBlock);
            config.get(cat, "baseBlockMeta", ore.metadata);
            config.get(cat, "baseBlockTexture", ore.texture);
            config.get(cat, "denseOreProbability", ore.prob);
            config.get(cat, "underlyingBlock", ore.underlyingBlock);
            config.get(cat, "retroGenId", 0);
            config.get(cat, "renderType", ore.rendertype);
        }

        // go through all categories and add them to the registry if they match
        for (String cat : config.getCategoryNames()) {
            if (cat.startsWith(CATEGORY_BLOCK)) {
                try {
                    // get the text after ores.block_ and try to convert it to
                    // an integer
                    int id = Integer.parseInt(cat.substring(CATEGORY_BLOCK.length()));

                    if (config.hasKey(cat, "requiredMod") && !config.get(cat, "requiredMod", "").getString().equals("") && !Loader.isModLoaded(config.get(cat, "requiredMod", "").getString()))
                        return;

                    // register the block
                    if (!DenseOresRegistry.hasEntry(id) && config.hasKey(cat, "baseBlock") && config.hasKey(cat, "baseBlockTexture")) {


                        DenseOre denseOre = DenseOresRegistry.registerOre(id,
                                config.get(cat, "baseBlock", "").getString().trim(),
                                config.get(cat, "baseBlockMeta", 0).getInt(0),
                                config.get(cat, "denseOreProbability", 1).getDouble(1),
                                config.get(cat, "underlyingBlock", "stone").getString().trim(),
                                config.get(cat, "baseBlockTexture", "").getString().trim(),
                                config.get(cat, "retroGenID", 0).getInt(),
                                config.get(cat, "renderType", 0).getInt(0));
                        if (denseOre != null) {
                            if (config.hasKey(cat, "underlyingBlockTexture")) {
                                denseOre.underlyingBlocktexture = config.get(cat, "underlyingBlockTexture", denseOre.baseBlock).getString();
                            }

//                            if (config.hasKey(cat, "baseBlockTextureOverlay_0")) {
//                                List<String> overlayList = new ArrayList<String>();
//                                for (int i = 0; config.hasKey(cat, "baseBlockTextureOverlay_" + i); i++) {
//                                    overlayList.add(config.get(cat, "baseBlockTextureOverlay_" + i, "").getString());
//                                }
//                                String[] overlays = overlayList.toArray(new String[overlayList.size()]);
//                            }
                        }

                    }
                } catch (NumberFormatException e) { // text after ore.block_ was
                    // not an integer
                }
            }
        }

        config.save();

    }
View Full Code Here

    }

    @Override
    public void init()
    {
        config = new Configuration(file);
        config.load();

        Property prop = config.get("WorldControl", "BlocksPerTick", 20);
        prop.comment = "Specifies the maximum blocks/tick that can be changed via the WorldControl functions. Powerful computers may set it higher, servers may want to keep it lower.";
        blocksPerTick = prop.getInt();
View Full Code Here

    public void doPreInit(FMLPreInitializationEvent e)
    {

        if (FMLCommonHandler.instance().getSide().isClient())
        {
            config = new ClientConfig(new Configuration(e.getSuggestedConfigurationFile()));
            config.init();
        }
        netHandler = NetworkRegistry.INSTANCE.newSimpleChannel("forgeessentials");
        netHandler.registerMessage(C0PacketHandshake.class, C0PacketHandshake.class, 0, Side.SERVER);
        netHandler.registerMessage(C1PacketSelectionUpdate.class, C1PacketSelectionUpdate.class, 1, Side.CLIENT);
View Full Code Here

        if (file.exists())
        {
            file.delete();
        }

        Configuration cfg = new Configuration(file, true);

        // write each and every field to the config file.
        for (Entry<String, Object> entry : objectData.getAllFields())
        {
            writeFieldToProperty(cfg, type.getFileSafeName(), entry.getKey(), entry.getValue());
        }

        cfg.save();

        return wasSuccessful;
    }
View Full Code Here

        if (!file.exists())
        {
            return null;
        }

        Configuration cfg = new Configuration(file, true);
        cfg.load();
        ITypeInfo<?> info = DataStorageManager.getInfoForType(type);
        TypeData data = DataStorageManager.getDataForType(type);
        readClassFromProperty(cfg, cfg.getCategory(type.getFileSafeName()), data, info);
        data.setUniqueKey(uniqueKey);

        return data;
    }
View Full Code Here

     * @param folder
     */
    public static void loadConfig(File folder)
    {
        File confFile = new File(folder, "CommandShortcuts.cfg");
        config = new Configuration(confFile);
        parseConfig();
    }
View Full Code Here

    private static class ConfigFile {

        public ConfigFile(File path)
        {
            config = new Configuration(path, true);
        }
View Full Code Here

        meta.screenshots = new String[0];
        meta.logoFile    = "/forge_logo.png";

        config = null;
        File cfgFile = new File(Loader.instance().getConfigDir(), "forge.cfg");
        config = new Configuration(cfgFile);

        syncConfig(true);
    }
View Full Code Here

    }

    static void captureConfig(File configDir)
    {
        cfgFile = new File(configDir,"forgeChunkLoading.cfg");
        config = new Configuration(cfgFile, true);
        try
        {
            config.load();
        }
        catch (Exception e)
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.config.Configuration$UnicodeInputStreamReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.