Search in sources :

Example 1 with Property

use of net.minecraftforge.common.Property in project compactsolars by cpw.

the class CompactSolars method preInit.

@EventHandler
public void preInit(FMLPreInitializationEvent preinit) {
    Version.init(preinit.getVersionProperties());
    preinit.getModMetadata().version = Version.version();
    Configuration cfg = new Configuration(preinit.getSuggestedConfigurationFile());
    try {
        cfg.load();
        Property block = cfg.getBlock("compactSolar", 650);
        block.comment = "The block id for the compact solar arrays.";
        compactSolarBlock = new BlockCompactSolar(block.getInt(650));
        CompactSolarType.buildHats(cfg, 19551);
        Property scale = cfg.get(Configuration.CATEGORY_GENERAL, "scaleFactor", 1);
        scale.comment = "The EU generation scaling factor. " + "The average number of ticks needed to generate one EU packet." + "1 is every tick, 2 is every other tick etc. " + "Each Solar will still generate a whole packet (8, 64, 512 EU).";
        productionRate = scale.getInt(1);
    } catch (Exception e) {
        FMLLog.log(Level.SEVERE, e, "CompactSolars was unable to load it's configuration successfully");
        throw new RuntimeException(e);
    } finally {
        cfg.save();
    }
}
Also used : Configuration(net.minecraftforge.common.Configuration) Property(net.minecraftforge.common.Property) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Aggregations

EventHandler (cpw.mods.fml.common.Mod.EventHandler)1 Configuration (net.minecraftforge.common.Configuration)1 Property (net.minecraftforge.common.Property)1