Package net.minecraftforge.common.config

Examples of net.minecraftforge.common.config.Property


        return get(Configuration.CATEGORY_GENERAL, tag, defaultValue, comment);
    }

    private static Property get(String cat, String tag, String defaultValue, String comment) {
        comment = COMMENT_PREFIX + comment.replace("{t}", tag) + COMMENT_SUFFIX;
        Property prop = configMain.get(cat, tag, defaultValue);
        prop.comment = comment;
        return prop;
    }
View Full Code Here


        prop.comment = comment;
        return prop;
    }

    private static void loadLootProperty(String tag, int defaultValue) {
        Property prop = configMain.get(CAT_LOOT, tag, defaultValue);
        int chance = parseInteger(prop, defaultValue);
        lootChances.put(tag, chance);
    }
View Full Code Here

        int chance = parseInteger(prop, defaultValue);
        lootChances.put(tag, chance);
    }

    private static void loadCartProperty(String tag) {
        Property prop = configMain.get(CAT_CARTS, tag, true);
        carts.put(tag, prop.getBoolean(true));
    }
View Full Code Here

        stage = Stage.FINISHED;
    }

    private static boolean isEnabled(Configuration config, Module m) {
        boolean defaultValue = true;
        Property prop = config.get(CATEGORY_MODULES, m.toString().toLowerCase(Locale.ENGLISH).replace('_', '.'), defaultValue);
        return prop.getBoolean(true);
    }
View Full Code Here

public class ConfigurationHelper
{
    public static String getString(Configuration configuration, String name, String category, String defaultValue, String comment, String[] validValues, String langKey)
    {
        Property property = configuration.get(category, name, defaultValue);
        property.setValidValues(validValues);
        property.setLanguageKey(langKey);
        property.comment = comment + " [default: " + defaultValue + "]";
        String value = property.getString();

        for (int i = 0; i < validValues.length; i++)
        {
            if (value.equalsIgnoreCase(validValues[i]))
            {
View Full Code Here

   
    mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf"));
    try {
      mainConfiguration.load();

      Property updateCheck = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "update.check", true);
      updateCheck.comment = "set to true for version check on startup";
      if (updateCheck.getBoolean(true)) {
        Version.check();
      }

      Property dropBlock = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "dropBrokenBlocks", true);
      dropBlock.comment = "set to false to prevent fillers from dropping blocks.";
      dropBrokenBlocks = dropBlock.getBoolean(true);

      Property lifespan = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "itemLifespan", itemLifespan);
      lifespan.comment = "the lifespan in ticks of items dropped on the ground by pipes and machines, vanilla = 6000, default = 1200";
      itemLifespan = lifespan.getInt(itemLifespan);
      if (itemLifespan < 100) {
        itemLifespan = 100;
      }

      Property factor = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "network.updateFactor", 10);
      factor.comment = "increasing this number will decrease network update frequency, useful for overloaded servers";
      updateFactor = factor.getInt(10);

      Property longFactor = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "network.stateRefreshPeriod", 40);
      longFactor.comment = "delay between full client sync packets, increasing it saves bandwidth, decreasing makes for better client syncronization.";
      longUpdateFactor = longFactor.getInt(40);

      wrenchItem = (new ItemWrench()).setUnlocalizedName("wrenchItem");
      CoreProxy.proxy.registerItem(wrenchItem);

      mapLocationItem = (new ItemMapLocation()).setUnlocalizedName("mapLocation");
      CoreProxy.proxy.registerItem(mapLocationItem);

      listItem = (new ItemList()).setUnlocalizedName("list");
      CoreProxy.proxy.registerItem(listItem);

      Property modifyWorldProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "modifyWorld", true);
      modifyWorldProp.comment = "set to false if BuildCraft should not generate custom blocks (e.g. oil)";
      modifyWorld = modifyWorldProp.getBoolean(true);

      if (BuildCraftCore.modifyWorld) {
        BlockSpring.EnumSpring.WATER.canGen = BuildCraftCore.mainConfiguration.get("worldgen", "waterSpring", true).getBoolean(true);
        springBlock = new BlockSpring().setBlockName("eternalSpring");
        CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class);
      }

      Property consumeWater = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "consumeWater", consumeWaterSources);
      consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
      consumeWater.comment = "set to true if the Pump should consume water";

      woodenGearItem = (new ItemGear()).setUnlocalizedName("woodenGearItem");
      CoreProxy.proxy.registerItem(woodenGearItem);
      OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));
View Full Code Here

    String name = Block.blockRegistry.getNameForObject(block);
    return isSupported(block, metadata) && !blocksForbidden.contains(name) && !modsForbidden.contains(name.split(":", 2)[0]);
  }

  public void readConfiguration(Configuration conf) {
    Property excludedMods = conf.get(Configuration.CATEGORY_GENERAL, "builder.excludedMods", new String[0],
        "mods that should be excluded from the builder.");
    Property excludedBlocks = conf.get(Configuration.CATEGORY_GENERAL, "builder.excludedBlocks", new String[0],
        "blocks that should be excluded from the builder.");

    for (String id : excludedMods.getStringList()) {
      String strippedId = JavaTools.stripSurroundingQuotes(id.trim());

      if (strippedId.length() > 0) {
        modsForbidden.add(strippedId);
      }
    }

    for (String id : excludedBlocks.getStringList()) {
      String strippedId = JavaTools.stripSurroundingQuotes(id.trim());

      if (strippedId.length() > 0) {
        blocksForbidden.add(strippedId);
      }
View Full Code Here

  public static boolean needsUpdateNoticeAndMarkAsSeen() {
    if (!isOutdated() || sentIMCOutdatedMessage) {
      return false;
    }

    Property property = BuildCraftCore.mainConfiguration.get("vars", "version.seen", VERSION);
    property.comment = "indicates the last version the user has been informed about and will suppress further notices on it.";
    String seenVersion = property.getString();

    if (recommendedVersion == null || recommendedVersion.equals(seenVersion)) {
      return false;
    }

    property.set(recommendedVersion);
    BuildCraftCore.mainConfiguration.save();
    return true;
  }
View Full Code Here

    super(file);
  }

  @Override
  public void save() {
    Property versionProp = get(CATEGORY_GENERAL, "version", Version.VERSION);
    versionProp.set(Version.VERSION);
    super.save();
  }
View Full Code Here

  }

  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent evt) {
    try {
      Property durability = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.durability", DefaultProps.PIPES_DURABILITY);
      durability.comment = "How long a pipe will take to break";
      pipeDurability = (float) durability.getDouble(DefaultProps.PIPES_DURABILITY);

      Property baseFlowRate = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.fluids.baseFlowRate", DefaultProps.PIPES_FLUIDS_BASE_FLOW_RATE);
      pipeFluidsBaseFlowRate = baseFlowRate.getInt();

      Property printFacadeList = BuildCraftCore.mainConfiguration.get("debug", "facades.printFacadeList", false);
      debugPrintFacadeList = printFacadeList.getBoolean();

      Property exclusionItemList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "woodenPipe.item.exclusion", new String[0]);

      String[] excludedItemBlocks = exclusionItemList.getStringList();
      if (excludedItemBlocks != null) {
        for (int j = 0; j < excludedItemBlocks.length; ++j) {
          excludedItemBlocks[j] = excludedItemBlocks[j].trim();
        }
      } else {
        excludedItemBlocks = new String[0];
      }

      Property exclusionFluidList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "woodenPipe.liquid.exclusion", new String[0]);

      String[] excludedFluidBlocks = exclusionFluidList.getStringList();
      if (excludedFluidBlocks != null) {
        for (int j = 0; j < excludedFluidBlocks.length; ++j) {
          excludedFluidBlocks[j] = excludedFluidBlocks[j].trim();
        }
      } else {
        excludedFluidBlocks = new String[0];
      }

      filteredBufferBlock = new BlockFilteredBuffer();
      CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));

      PipeManager.registerExtractionHandler(new ExtractionHandler(excludedItemBlocks, excludedFluidBlocks));

      GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
      GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
      GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);

      Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.groupItemsTrigger", 32);
      groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
      groupItemsTrigger = groupItemsTriggerProp.getInt();

      Property facadeBlacklistProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "facade.blacklist", new String[] {
          Block.blockRegistry.getNameForObject(Blocks.bedrock),
          Block.blockRegistry.getNameForObject(Blocks.command_block),
          Block.blockRegistry.getNameForObject(Blocks.end_portal_frame),
          Block.blockRegistry.getNameForObject(Blocks.grass),
          Block.blockRegistry.getNameForObject(Blocks.leaves),
          Block.blockRegistry.getNameForObject(Blocks.leaves2),
          Block.blockRegistry.getNameForObject(Blocks.lit_pumpkin),
          Block.blockRegistry.getNameForObject(Blocks.lit_redstone_lamp),
          Block.blockRegistry.getNameForObject(Blocks.mob_spawner),
          Block.blockRegistry.getNameForObject(Blocks.monster_egg),
          Block.blockRegistry.getNameForObject(Blocks.redstone_lamp),
          Block.blockRegistry.getNameForObject(Blocks.double_stone_slab),
          Block.blockRegistry.getNameForObject(Blocks.double_wooden_slab),
          Block.blockRegistry.getNameForObject(Blocks.sponge),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.architectBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.builderBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.fillerBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.libraryBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.autoWorkbenchBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.floodGateBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.miningWellBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.pumpBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.quarryBlock)),
          JavaTools.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftTransport.filteredBufferBlock)),
      });

      facadeBlacklistProp.comment = "Blocks listed here will not have facades created. The format is modid:blockname.\nFor mods with a | character, the value needs to be surrounded with quotes.";
      facadeBlacklist = facadeBlacklistProp.getStringList();

      pipeWaterproof = new ItemBuildCraft();

      pipeWaterproof.setUnlocalizedName("pipeWaterproof");
      CoreProxy.proxy.registerItem(pipeWaterproof);
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.config.Property

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.