Jump to content

ArcaneBlackwood

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by ArcaneBlackwood

  1. Im new to Forge modding, Im currently trying to create a config that follows a structure like, or equivalent to this:

    # Configuration file
    materials [
      # some default comment that describes what these values do
      {
        S:ore=thermalfoundation:ore:0
        S:ingot=thermalfoundation:material:128
        S:dust=thermalfoundation:material:64
      } {
        S:ore=thermalfoundation:ore:1
        S:ingot=thermalfoundation:material:129
        S:dust=thermalfoundation:material:65
      } {
        S:ore=thermalfoundation:ore:2
        S:ingot=thermalfoundation:material:130
        S:dust=thermalfoundation:material:66
      }
      ## ... etc
    ]
    general {
      B:enableDebug=true
      I:stuffidk=100
      ## etc etc
    }

    I want my mod to be standalone in sense of only having to have a forge installation.  Im quite reluctant to create custom scripts that parse and serialize raw text from files, and would like to keep using forge's provided configutation manager.  I want the amount of entry's in materials to be variable, with each having no name if possible.

     

    Right now my code is fairly simple.  How would I go about achieving the above?

        public static Configuration config;
        private static String fileLocation = "config/"+OreUnify.MODID+".cfg";
    
        public static void init() {
            config = new Configuration(new File(fileLocation));
            //TODO default initialisation of config if empty
    
            try {
                config.load();
            } catch (Exception e) {
                System.out.println("Cannot load configuration file!");
            } finally {
                config.save();
            }
    
            //TODO read data and configure the mod
            ConfigCategory generalConfig = config.getCategory("general");
            someOtherThingIDK( generalConfig.get("enableDebug").getBoolean() );
            //anotherThingIteratingOverEntrys( ??? );
        }

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.