Java Code Examples for codechicken.lib.config.ConfigTag#setValue()

The following examples show how to use codechicken.lib.config.ConfigTag#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnderStorage.java    From EnderStorage with MIT License 5 votes vote down vote up
private void loadPersonalItem() {
    ConfigTag tag = config.getTag("personalItemID")
            .setComment("The name of the item used to set the chest to personal. Diamond by default");
    String name = tag.getValue("diamond");
    personalItem = (Item) Item.itemRegistry.getObject(name);
    if (personalItem == null) {
        personalItem = Items.diamond;
        tag.setValue("diamond");
    }
}
 
Example 2
Source File: ObfMapping.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static File[] getConfFiles() {
    
    // check for GradleStart system vars
    if (!Strings.isNullOrEmpty(System.getProperty("net.minecraftforge.gradle.GradleStart.srgDir")))
    {
        File srgDir = new File(System.getProperty("net.minecraftforge.gradle.GradleStart.srgDir"));
        File csvDir = new File(System.getProperty("net.minecraftforge.gradle.GradleStart.csvDir"));
        
        if (srgDir.exists() && csvDir.exists())
        {
            File srg = new File(srgDir, "notch-srg.srg");
            File fieldCsv = new File(csvDir, "fields.csv");
            File methodCsv = new File(csvDir, "methods.csv");
            
            if (srg.exists() && fieldCsv.exists() && methodCsv.exists())
                return new File[] {srg, fieldCsv, methodCsv};
        }
    }
    
    ConfigTag tag = ASMHelper.config.getTag("mappingDir").setComment("Path to directory holding packaged.srg, fields.csv and methods.csv for mcp remapping");
    for (int i = 0; i < DIR_GUESSES+DIR_ASKS; i++) {
        File dir = confDirectoryGuess(i, tag);
        if (dir == null || dir.isFile())
            continue;

        File[] mappings;
        try {
            mappings = parseConfDir(dir);
        } catch (Exception e) {
            if (i >= DIR_GUESSES)
                e.printStackTrace();
            continue;
        }

        tag.setValue(dir.getPath());
        return mappings;
    }

    throw new RuntimeException("Failed to select mappings directory, set it manually in the config");
}