Jump to content

Is it possible to choose order of @Config fields?


skeddles

Recommended Posts

I'm making a config file with @Config (and to use with the in game editor, which is where I'm looking at it)

It seems to sort the fields alphabetically by @Name. Is there a way to set the order or group them? Is there any way to add headings?

 

Also if you know of an example showing how to use the info set in the config file, that would be helpful.

Edited by skeddles
Link to comment
Share on other sites

If you really want to set the order, take advantage of the alphabetical ordering of @Name. Like this:

		@Config.Name("Biomes: Enable Biomes")
		public boolean enableBiomes = true;
		
		@Config.Name("Plants: Enable Overworld Plants")
		public boolean enableOverworldPlants = true;
		
		@Config.Name("Plants: Enable Nether Plants")
		public boolean enableNetherPlants = true;
		
		@Config.Name("Mobs: Enable Passive Mobs")
		public boolean enablePassiveMobs = true;
		
		@Config.Name("Mobs: Enable Neutral Mobs")
		public boolean enableNeutralMobs = true;
		
		@Config.Name("Mobs: Enable Aggressive Mobs")
		public boolean enableAggressiveMobs = true;

This will group them by plants, mobs, etc.

Link to comment
Share on other sites

While the @Config system is quite convenient, I still prefer the previous system. It works fine. I've recently been playing around with making even more complex config editing GUIs, like for example I have a mod where you can change the color of enchantment glints and so I have it so you can enter the number in hex and it will display a preview even though the actual value being stored is an int type. Basically I like having the full control. I suppose it is possible to get to same level with @Config but since I already have it all working why fix what ain't broke?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Not sure if this is possible, but I want to dynamically add options to my config based on loot tables added by any mods.

 

I thought maybe I could create an arraylist and then convert it to an enum? Doesn't seem to work though. Any advice?

 

ArrayList<String> modLootTables = new ArrayList<String>();

//loot tables
@SubscribeEvent
public static void lootLoadConfig(LootTableLoadEvent evt) {
    String name = evt.getName().toString();
    System.out.println("loot table in config!!!!" + name);

    entries.add(name);
    public static float damageScale = 1;
}

@Name("Loot Tables")
public static Enumeration<String> e = Collections.enumeration(modLootTables);
Link to comment
Share on other sites

enum != Enumeration

https://stackoverflow.com/a/19445327/1663383

 

Don't know about what you're trying to do, though.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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