Additional config options
This commit is contained in:
parent
192a537939
commit
3d45114584
10 changed files with 59 additions and 6 deletions
|
@ -13,7 +13,7 @@ import ru.bclib.interfaces.PatchFunction;
|
||||||
public final class BCLibPatch {
|
public final class BCLibPatch {
|
||||||
public static void register(){
|
public static void register(){
|
||||||
DataFixerAPI.registerPatch(BiomeSourcePatch::new);
|
DataFixerAPI.registerPatch(BiomeSourcePatch::new);
|
||||||
if (Configs.MAIN_CONFIG.getBoolean("data_fixer", "repairBiomesOnLoad", false)) {
|
if (Configs.MAIN_CONFIG.repairBiomes()) {
|
||||||
DataFixerAPI.registerPatch(BiomeFixPatch::new);
|
DataFixerAPI.registerPatch(BiomeFixPatch::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ public class DataFixerAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MigrationProfile loadProfileIfNeeded(File levelBaseDir){
|
private static MigrationProfile loadProfileIfNeeded(File levelBaseDir){
|
||||||
if (!Configs.MAIN_CONFIG.getBoolean(Configs.MAIN_PATCH_CATEGORY, "applyPatches", true)) {
|
if (!Configs.MAIN_CONFIG.applyPatches()) {
|
||||||
LOGGER.info("World Patches are disabled");
|
LOGGER.info("World Patches are disabled");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import ru.bclib.api.dataexchange.handler.autosync.AutoSync;
|
||||||
|
|
||||||
public class ClientConfig extends NamedPathConfig {
|
public class ClientConfig extends NamedPathConfig {
|
||||||
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
|
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
|
||||||
|
|
||||||
@ConfigUI(leftPadding = 8)
|
@ConfigUI(leftPadding = 8)
|
||||||
public static final DependendConfigToken<Boolean> ACCEPT_CONFIGS = DependendConfigToken.Boolean(true, "acceptConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
public static final DependendConfigToken<Boolean> ACCEPT_CONFIGS = DependendConfigToken.Boolean(true, "acceptConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||||
@ConfigUI(leftPadding = 8)
|
@ConfigUI(leftPadding = 8)
|
||||||
|
|
|
@ -14,8 +14,8 @@ public class Configs {
|
||||||
public static final ClientConfig CLIENT_CONFIG = new ClientConfig();
|
public static final ClientConfig CLIENT_CONFIG = new ClientConfig();
|
||||||
public static final ServerConfig SERVER_CONFIG = new ServerConfig();
|
public static final ServerConfig SERVER_CONFIG = new ServerConfig();
|
||||||
|
|
||||||
public static final PathConfig GENERATOR_CONFIG = new PathConfig(BCLib.MOD_ID, "generator", false);
|
public static final GeneratorConfig GENERATOR_CONFIG = new GeneratorConfig();
|
||||||
public static final PathConfig MAIN_CONFIG = new PathConfig(BCLib.MOD_ID, "main", true, true);
|
public static final MainConfig MAIN_CONFIG = new MainConfig();
|
||||||
|
|
||||||
public static final PathConfig RECIPE_CONFIG = new PathConfig(BCLib.MOD_ID, "recipes");
|
public static final PathConfig RECIPE_CONFIG = new PathConfig(BCLib.MOD_ID, "recipes");
|
||||||
public static final PathConfig BIOMES_CONFIG = new PathConfig(BCLib.MOD_ID, "biomes", false);
|
public static final PathConfig BIOMES_CONFIG = new PathConfig(BCLib.MOD_ID, "biomes", false);
|
||||||
|
|
16
src/main/java/ru/bclib/config/GeneratorConfig.java
Normal file
16
src/main/java/ru/bclib/config/GeneratorConfig.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package ru.bclib.config;
|
||||||
|
|
||||||
|
import ru.bclib.BCLib;
|
||||||
|
import ru.bclib.api.dataexchange.handler.autosync.AutoSync;
|
||||||
|
|
||||||
|
public class GeneratorConfig extends NamedPathConfig {
|
||||||
|
public static final ConfigToken<Boolean> USE_OLD_GENERATOR = ConfigToken.Boolean(false, "useOldBiomeGenerator", "options");
|
||||||
|
|
||||||
|
public GeneratorConfig() {
|
||||||
|
super(BCLib.MOD_ID, "generator", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean useOldGenerator() {
|
||||||
|
return get(USE_OLD_GENERATOR);
|
||||||
|
}
|
||||||
|
}
|
21
src/main/java/ru/bclib/config/MainConfig.java
Normal file
21
src/main/java/ru/bclib/config/MainConfig.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package ru.bclib.config;
|
||||||
|
|
||||||
|
import ru.bclib.BCLib;
|
||||||
|
|
||||||
|
public class MainConfig extends NamedPathConfig {
|
||||||
|
public static final ConfigToken<Boolean> APPLY_PATCHES = ConfigToken.Boolean(true, "applyPatches", Configs.MAIN_PATCH_CATEGORY);
|
||||||
|
@ConfigUI(leftPadding = 8)
|
||||||
|
public static final ConfigToken<Boolean> REPAIR_BIOMES = DependendConfigToken.Boolean(false, "repairBiomesOnLoad", Configs.MAIN_PATCH_CATEGORY, (config) -> config.get(APPLY_PATCHES));
|
||||||
|
|
||||||
|
|
||||||
|
public MainConfig() {
|
||||||
|
super(BCLib.MOD_ID, "main", true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean applyPatches() {
|
||||||
|
return get(REPAIR_BIOMES);
|
||||||
|
}
|
||||||
|
public boolean repairBiomes() {
|
||||||
|
return get(REPAIR_BIOMES);
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ import java.util.function.Supplier;
|
||||||
public class MainScreen extends GridScreen{
|
public class MainScreen extends GridScreen{
|
||||||
|
|
||||||
public MainScreen(@Nullable Screen parent) {
|
public MainScreen(@Nullable Screen parent) {
|
||||||
super(parent, new TranslatableComponent("title.bclib.modmenu.main"));
|
super(parent, new TranslatableComponent("title.bclib.modmenu.main"), 10, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T> TranslatableComponent getComponent(NamedPathConfig config, ConfigTokenDescription<T> option, String type){
|
protected <T> TranslatableComponent getComponent(NamedPathConfig config, ConfigTokenDescription<T> option, String type){
|
||||||
|
@ -72,6 +72,10 @@ public class MainScreen extends GridScreen{
|
||||||
protected void initLayout() {
|
protected void initLayout() {
|
||||||
final int BUTTON_HEIGHT = 20;
|
final int BUTTON_HEIGHT = 20;
|
||||||
|
|
||||||
|
Configs.GENERATOR_CONFIG.getAllOptions().stream().filter(o -> !o.hidden).forEach(o -> addRow(grid, Configs.GENERATOR_CONFIG, o));
|
||||||
|
grid.addSpacerRow(12);
|
||||||
|
Configs.MAIN_CONFIG.getAllOptions().stream().filter(o -> !o.hidden).forEach(o -> addRow(grid, Configs.MAIN_CONFIG, o));
|
||||||
|
grid.addSpacerRow(12);
|
||||||
Configs.CLIENT_CONFIG.getAllOptions().stream().filter(o -> !o.hidden).forEach(o -> addRow(grid, Configs.CLIENT_CONFIG, o));
|
Configs.CLIENT_CONFIG.getAllOptions().stream().filter(o -> !o.hidden).forEach(o -> addRow(grid, Configs.CLIENT_CONFIG, o));
|
||||||
|
|
||||||
grid.addSpacerRow(15);
|
grid.addSpacerRow(15);
|
||||||
|
@ -79,7 +83,10 @@ public class MainScreen extends GridScreen{
|
||||||
row.addFiller();
|
row.addFiller();
|
||||||
row.addButton(CommonComponents.GUI_DONE, BUTTON_HEIGHT, font, (button)->{
|
row.addButton(CommonComponents.GUI_DONE, BUTTON_HEIGHT, font, (button)->{
|
||||||
Configs.CLIENT_CONFIG.saveChanges();
|
Configs.CLIENT_CONFIG.saveChanges();
|
||||||
|
Configs.GENERATOR_CONFIG.saveChanges();
|
||||||
|
Configs.MAIN_CONFIG.saveChanges();
|
||||||
onClose();
|
onClose();
|
||||||
});
|
});
|
||||||
|
grid.addSpacerRow(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class GeneratorOptions {
|
||||||
customEndBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options", "customEndBiomeSource", true);
|
customEndBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options", "customEndBiomeSource", true);
|
||||||
addNetherBiomesByCategory = Configs.GENERATOR_CONFIG.getBoolean("options", "addNetherBiomesByCategory", false);
|
addNetherBiomesByCategory = Configs.GENERATOR_CONFIG.getBoolean("options", "addNetherBiomesByCategory", false);
|
||||||
addEndBiomesByCategory = Configs.GENERATOR_CONFIG.getBoolean("options", "addEndBiomesByCategory", false);
|
addEndBiomesByCategory = Configs.GENERATOR_CONFIG.getBoolean("options", "addEndBiomesByCategory", false);
|
||||||
useOldBiomeGenerator = Configs.GENERATOR_CONFIG.getBoolean("options", "useOldBiomeGenerator", false);
|
useOldBiomeGenerator = Configs.GENERATOR_CONFIG.useOldGenerator();
|
||||||
verticalBiomes = Configs.GENERATOR_CONFIG.getBoolean("options", "verticalBiomesInTallNether", true);
|
verticalBiomes = Configs.GENERATOR_CONFIG.getBoolean("options", "verticalBiomesInTallNether", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
"title.config.bclib.client.auto_sync.acceptMods": "Mods von Server annehmen",
|
"title.config.bclib.client.auto_sync.acceptMods": "Mods von Server annehmen",
|
||||||
"title.config.bclib.client.auto_sync.displayModInfo": "Warnung anzeigen wen Mods auf Server/Client unterschiedlich",
|
"title.config.bclib.client.auto_sync.displayModInfo": "Warnung anzeigen wen Mods auf Server/Client unterschiedlich",
|
||||||
"title.config.bclib.client.auto_sync.debugHashes": "Erweiterete Logausgabe für Auto-Sync",
|
"title.config.bclib.client.auto_sync.debugHashes": "Erweiterete Logausgabe für Auto-Sync",
|
||||||
|
|
||||||
|
"title.config.bclib.generator.options.useOldBiomeGenerator": "Alten 1.17 Biome Generator verwenden",
|
||||||
|
"title.config.bclib.main.patches.applyPatches": "Automatisches Anwenden von Patches beim Laden eines Levels",
|
||||||
|
"title.config.bclib.main.patches.repairBiomesOnLoad": "Biomesource beim Laden eines Levels reparieren",
|
||||||
|
|
||||||
"title.bclib.syncfiles.modInfo": "Mod Info",
|
"title.bclib.syncfiles.modInfo": "Mod Info",
|
||||||
"title.bclib.syncfiles.modlist": "Mod Information",
|
"title.bclib.syncfiles.modlist": "Mod Information",
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
"title.config.bclib.client.auto_sync.acceptMods": "Accept incoming Mods",
|
"title.config.bclib.client.auto_sync.acceptMods": "Accept incoming Mods",
|
||||||
"title.config.bclib.client.auto_sync.displayModInfo": "Display warning when Serverside Mods differ from Client",
|
"title.config.bclib.client.auto_sync.displayModInfo": "Display warning when Serverside Mods differ from Client",
|
||||||
"title.config.bclib.client.auto_sync.debugHashes": "Print Auto-Sync Debug-Hashes to Log",
|
"title.config.bclib.client.auto_sync.debugHashes": "Print Auto-Sync Debug-Hashes to Log",
|
||||||
|
|
||||||
|
"title.config.bclib.generator.options.useOldBiomeGenerator": "Use legacy 1.17 Biome Generator",
|
||||||
|
"title.config.bclib.main.patches.applyPatches": "Automatically apply patches when loading level",
|
||||||
|
"title.config.bclib.main.patches.repairBiomesOnLoad": "Fix Biomesource on level load",
|
||||||
|
|
||||||
"title.bclib.syncfiles.modInfo": "Mod Info",
|
"title.bclib.syncfiles.modInfo": "Mod Info",
|
||||||
"title.bclib.syncfiles.modlist": "Mod Information",
|
"title.bclib.syncfiles.modlist": "Mod Information",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue