2021-06-19 07:52:33 +02:00
|
|
|
package com.jozufozu.flywheel.config;
|
|
|
|
|
2021-06-30 21:43:54 +02:00
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
|
|
2021-06-19 07:52:33 +02:00
|
|
|
import net.minecraftforge.common.ForgeConfigSpec;
|
|
|
|
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
|
2022-02-02 05:44:53 +01:00
|
|
|
import net.minecraftforge.common.ForgeConfigSpec.EnumValue;
|
2021-06-19 07:52:33 +02:00
|
|
|
import net.minecraftforge.fml.ModLoadingContext;
|
|
|
|
import net.minecraftforge.fml.config.ModConfig;
|
|
|
|
|
|
|
|
public class FlwConfig {
|
|
|
|
|
|
|
|
private static final FlwConfig INSTANCE = new FlwConfig();
|
|
|
|
|
|
|
|
public final ClientConfig client;
|
|
|
|
|
|
|
|
public FlwConfig() {
|
|
|
|
Pair<ClientConfig, ForgeConfigSpec> client = new ForgeConfigSpec.Builder().configure(ClientConfig::new);
|
|
|
|
|
|
|
|
this.client = client.getLeft();
|
|
|
|
|
2021-06-30 21:43:54 +02:00
|
|
|
ModLoadingContext.get()
|
|
|
|
.registerConfig(ModConfig.Type.CLIENT, client.getRight());
|
2021-06-19 07:52:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static FlwConfig get() {
|
|
|
|
return INSTANCE;
|
|
|
|
}
|
|
|
|
|
2022-04-07 23:19:36 +02:00
|
|
|
public BackendType getBackendType() {
|
|
|
|
return client.backend.get();
|
2021-06-19 07:52:33 +02:00
|
|
|
}
|
|
|
|
|
2021-07-26 22:42:38 +02:00
|
|
|
public boolean debugNormals() {
|
|
|
|
return client.debugNormals.get();
|
2021-06-19 07:52:33 +02:00
|
|
|
}
|
|
|
|
|
2022-02-01 22:54:38 +01:00
|
|
|
public boolean limitUpdates() {
|
|
|
|
return client.limitUpdates.get();
|
|
|
|
}
|
|
|
|
|
2021-06-30 21:43:54 +02:00
|
|
|
public static void init() {
|
|
|
|
}
|
2021-06-19 07:52:33 +02:00
|
|
|
|
|
|
|
public static class ClientConfig {
|
2022-04-07 23:19:36 +02:00
|
|
|
public final EnumValue<BackendType> backend;
|
2021-07-26 22:42:38 +02:00
|
|
|
public final BooleanValue debugNormals;
|
2022-02-01 22:54:38 +01:00
|
|
|
public final BooleanValue limitUpdates;
|
2021-06-19 07:52:33 +02:00
|
|
|
|
|
|
|
public ClientConfig(ForgeConfigSpec.Builder builder) {
|
2022-04-07 23:19:36 +02:00
|
|
|
backend = builder.comment("Select the backend to use.")
|
|
|
|
.defineEnum("backend", BackendType.INSTANCING);
|
2021-12-15 09:35:48 +01:00
|
|
|
|
2022-04-07 23:19:36 +02:00
|
|
|
debugNormals = builder.comment("Enable or disable a debug overlay that colors pixels by their normal.")
|
2021-07-26 22:42:38 +02:00
|
|
|
.define("debugNormals", false);
|
2022-02-01 22:54:38 +01:00
|
|
|
|
|
|
|
limitUpdates = builder.comment("Enable or disable instance update limiting with distance.")
|
|
|
|
.define("limitUpdates", true);
|
2021-06-19 07:52:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|