Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.15.2] Config files not reading changes from any value after the first

Featured Replies

Posted

I have added config files to my mod, however only the first value in each can be changed

 

For example one of my configs looks like this:

[dodge]
	#The time it takes for your dodge to refresh. 
	#Note that this value must be an integer (whole number) that is 2 or higher, or else things will not fire properly. 
	#Default: 4
	#Range: 2 ~ 20
	cooldown_time = 4
	#Whether or not you have to be touching the ground to dodge. 
	#Without this enabled the dodge ability can be used like a dash whilst jumping, which may be overpowered. 
	#Default: true
	requires_ground = false

And no matter what I do to requires_ground, it always will equal its default value, however I can change cooldown_time.

 

 

Here is my Config builder:

@Mod.EventBusSubscriber
public class Config {
	private static final ForgeConfigSpec.Builder server_builder = new ForgeConfigSpec.Builder();
	public static final ForgeConfigSpec server_config;
	
	private static final ForgeConfigSpec.Builder client_builder = new ForgeConfigSpec.Builder();
	public static final ForgeConfigSpec client_config;
	
	static {
		DodgeConfig.init(server_builder, client_builder);
		
		server_config = server_builder.build();
		client_config = client_builder.build();
	}
	
	public static void loadConfig(ForgeConfigSpec config, String path) {
		Dodge.LOGGER.info("Loading config: " + path);
		final CommentedFileConfig file = CommentedFileConfig.builder(new File(path)).sync().autosave().writingMode(WritingMode.REPLACE).build();
		Dodge.LOGGER.info("Built config: " + path);
		file.load();
		Dodge.LOGGER.info("Loaded config: " + path);
		config.setConfig(file);
	}
}

 

And here is my Config:

public class DodgeConfig {
	public static ForgeConfigSpec.IntValue cooldown_time;
	public static ForgeConfigSpec.BooleanValue requires_ground;
	
	public static void init(ForgeConfigSpec.Builder server, ForgeConfigSpec.Builder client) {
		server.comment("dodge config");
		
		cooldown_time = server
				.comment("The time it takes for your dodge to refresh. \nNote that this value must be an integer (whole number) that is 2 or higher, or else things will not fire properly. \nDefault: 4")
				.defineInRange("dodge.cooldown_time", 4, 2, 20);
		
		requires_ground = server
				.comment("Whether or not you have to be touching the ground to dodge. \nWithout this enabled the dodge ability can be used like a dash whilst jumping, which may be overpowered. \nDefault: true")
				.define("dodge.requires_ground", false);
	}
}

 

It is also worth noting that I have updated my DodgeConfig class and deleted my server-config.toml, however upon running minecraft server-config.toml reverts to how it was before I applied my changes.

 

I'm so confused so any help would be greatly appreciated.

 

Alternatively, if you know a better way to create a config in1.15.2 please share!

Edited by ultra_reemun
Alternate

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.