use of me.shedaniel.clothconfig2.api.ConfigBuilder in project twitch-chat by pblop.
the class ModMenuCompat method getModConfigScreenFactory.
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return (ConfigScreenFactory<Screen>) screen -> {
ConfigBuilder builder = ConfigBuilder.create();
builder.setTitle(new TranslatableText("config.twitchchat.title"));
builder.setSavingRunnable(() -> ModConfig.getConfig().save());
ConfigEntryBuilder entryBuilder = ConfigEntryBuilder.create();
ConfigCategory cosmeticsCategory = builder.getOrCreateCategory(new TranslatableText("config.twitchchat.category.cosmetics"));
cosmeticsCategory.addEntry(entryBuilder.startStrField(new TranslatableText("config.twitchchat.cosmetics.prefix"), ModConfig.getConfig().getPrefix()).setSaveConsumer((s -> ModConfig.getConfig().setPrefix(s))).setTooltip(new TranslatableText("config.twitchchat.cosmetics.prefix.tooltip")).setDefaultValue(ModConfig.DEFAULT_PREFIX).build());
cosmeticsCategory.addEntry(entryBuilder.startStrField(new TranslatableText("config.twitchchat.cosmetics.dateFormat"), ModConfig.getConfig().getDateFormat()).setSaveConsumer((s -> ModConfig.getConfig().setDateFormat(s))).setTooltip(new TranslatableText("config.twitchchat.cosmetics.dateFormat.tooltip")).setDefaultValue(ModConfig.DEFAULT_DATE_FORMAT).build());
cosmeticsCategory.addEntry(entryBuilder.startStrList(new TranslatableText("config.twitchchat.cosmetics.ignorelist"), ModConfig.getConfig().getIgnoreList()).setSaveConsumer((l -> ModConfig.getConfig().setIgnoreList(new ArrayList<>(l)))).setTooltip(new TranslatableText("config.twitchchat.cosmetics.ignorelist.tooltip")).setDefaultValue(ModConfig.DEFAULT_IGNORE_LIST).build());
cosmeticsCategory.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.twitchchat.cosmetics.twitchWatchSuggestions"), ModConfig.getConfig().areTwitchWatchSuggestionsEnabled()).setSaveConsumer((b -> ModConfig.getConfig().setTwitchWatchSuggestions(b))).setTooltip(new TranslatableText("config.twitchchat.cosmetics.twitchWatchSuggestions.tooltip")).setDefaultValue(ModConfig.DEFAULT_TWITCH_WATCH_SUGGESTIONS).build());
ConfigCategory broadcastCategory = builder.getOrCreateCategory(new TranslatableText("config.twitchchat.category.broadcast"));
broadcastCategory.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.twitchchat.broadcast.toggle"), ModConfig.getConfig().isBroadcastEnabled()).setSaveConsumer((b -> ModConfig.getConfig().setBroadcastEnabled(b))).setTooltip(new TranslatableText("config.twitchchat.broadcast.toggle.tooltip")).setDefaultValue(ModConfig.DEFAULT_BROADCAST).build());
broadcastCategory.addEntry(entryBuilder.startStrField(new TranslatableText("config.twitchchat.broadcast.prefix"), ModConfig.getConfig().getBroadcastPrefix()).setSaveConsumer((s -> ModConfig.getConfig().setBroadcastPrefix(s))).setTooltip(new TranslatableText("config.twitchchat.broadcast.prefix.tooltip")).setDefaultValue(ModConfig.DEFAULT_BROADCAST_PREFIX).build());
ConfigCategory credentialsCategory = builder.getOrCreateCategory(new TranslatableText("config.twitchchat.category.credentials"));
credentialsCategory.addEntry(entryBuilder.startStrField(new TranslatableText("config.twitchchat.credentials.username"), ModConfig.getConfig().getUsername()).setSaveConsumer((s -> ModConfig.getConfig().setUsername(s))).setTooltip(new TranslatableText("config.twitchchat.credentials.username.tooltip")).setDefaultValue(ModConfig.DEFAULT_USERNAME).build());
credentialsCategory.addEntry(entryBuilder.startStrField(new TranslatableText("config.twitchchat.credentials.oauthKey"), ModConfig.getConfig().getOauthKey()).setSaveConsumer((s -> ModConfig.getConfig().setOauthKey(s))).setTooltip(new TranslatableText("config.twitchchat.credentials.oauthKey.tooltip")).setDefaultValue(ModConfig.DEFAULT_OAUTH_KEY).build());
return builder.build();
};
}
use of me.shedaniel.clothconfig2.api.ConfigBuilder in project BedrockIfy by juancarloscp52.
the class SettingsGUI method getConfigScreen.
public Screen getConfigScreen(Screen parent, boolean isTransparent) {
ConfigBuilder builder = ConfigBuilder.create().setParentScreen(parent).setTitle(new TranslatableText("bedrockify.options.settings"));
builder.setSavingRunnable(() -> Bedrockify.getInstance().saveSettings());
ConfigCategory general = builder.getOrCreateCategory(new LiteralText("General"));
ConfigEntryBuilder entryBuilder = builder.entryBuilder();
SubCategoryBuilder bedrockOverlay = entryBuilder.startSubCategory(new TranslatableText("bedrockify.options.subCategory.bedrockOverlay"));
bedrockOverlay.add(entryBuilder.startTextDescription(new TranslatableText("bedrockify.options.subCategory.bedrockOverlay.description")).build());
bedrockOverlay.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.showCoordinates"), settings.showPositionHUD).setDefaultValue(true).setSaveConsumer(newValue -> settings.showPositionHUD = newValue).build());
bedrockOverlay.add(entryBuilder.startSelector(new TranslatableText("bedrockify.options.showFPS"), new Byte[] { 0, 1, 2 }, settings.FPSHUD).setDefaultValue((byte) 0).setNameProvider((value) -> {
switch(value) {
case 0:
return new TranslatableText("bedrockify.options.off");
case 1:
return new TranslatableText("bedrockify.options.withPosition");
default:
return new TranslatableText("bedrockify.options.underPosition");
}
}).setSaveConsumer((newValue) -> settings.FPSHUD = newValue).build());
bedrockOverlay.add(entryBuilder.startIntSlider(new TranslatableText("bedrockify.options.coordinatesPosition"), settings.positionHUDHeight, 0, 100).setDefaultValue(50).setSaveConsumer((newValue) -> settings.positionHUDHeight = newValue).build());
bedrockOverlay.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.showPaperDoll"), settings.showPaperDoll).setDefaultValue(true).setSaveConsumer(newValue -> settings.showPaperDoll = newValue).build());
bedrockOverlay.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.showSavingOverlay"), settings.savingOverlay).setDefaultValue(true).setSaveConsumer(newValue -> settings.savingOverlay = newValue).build());
general.addEntry(bedrockOverlay.build());
SubCategoryBuilder guiImprovements = entryBuilder.startSubCategory(new TranslatableText("bedrockify.options.subCategory.visualImprovements"));
guiImprovements.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.chatStyle"), settings.bedrockChat).setDefaultValue(true).setSaveConsumer(newValue -> settings.bedrockChat = newValue).setYesNoTextSupplier((value) -> value ? new TranslatableText("bedrockify.options.chatStyle.bedrock") : new TranslatableText("bedrockify.options.chatStyle.vanilla")).build());
guiImprovements.add(entryBuilder.startIntSlider(new TranslatableText("bedrockify.options.screenSafeArea"), settings.screenSafeArea, 0, 30).setDefaultValue(0).setSaveConsumer((newValue) -> settings.screenSafeArea = newValue).build());
guiImprovements.add(entryBuilder.startSelector(new TranslatableText("bedrockify.options.tooltips"), new Byte[] { 0, 1, 2 }, settings.heldItemTooltip).setDefaultValue((byte) 2).setNameProvider((value) -> {
switch(value) {
case 0:
return new TranslatableText("bedrockify.options.off");
case 1:
return new TranslatableText("bedrockify.options.on");
default:
return new TranslatableText("bedrockify.options.withBackground");
}
}).setSaveConsumer((newValue) -> settings.heldItemTooltip = newValue).build());
guiImprovements.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.inventoryHighlight"), settings.slotHighlight).setDefaultValue(true).setSaveConsumer(newValue -> settings.slotHighlight = newValue).build());
guiImprovements.add(entryBuilder.startSelector(new TranslatableText("bedrockify.options.idleAnimation"), new Float[] { 0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 4.0f }, settings.idleAnimation).setDefaultValue(1.0f).setNameProvider((value) -> new LiteralText("x" + value)).setSaveConsumer((newValue) -> settings.idleAnimation = newValue).build());
guiImprovements.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.eatingAnimations"), settings.eatingAnimations).setDefaultValue(true).setSaveConsumer(newValue -> settings.eatingAnimations = newValue).build());
guiImprovements.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.pickupAnimations"), settings.pickupAnimations).setTooltip(wrapLines(new TranslatableText("bedrockify.options.pickupAnimations.tooltip"))).setDefaultValue(true).setSaveConsumer(newValue -> settings.pickupAnimations = newValue).build());
guiImprovements.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.loadingScreen"), settings.loadingScreen).setDefaultValue(true).setSaveConsumer(newValue -> settings.loadingScreen = newValue).build());
general.addEntry(guiImprovements.build());
SubCategoryBuilder reachAround = entryBuilder.startSubCategory(new TranslatableText("bedrockify.options.subCategory.Reach-Around"));
reachAround.add(entryBuilder.startTextDescription(new TranslatableText("bedrockify.options.subCategory.Reach-Around.description")).build());
reachAround.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.reachAround"), settings.reacharound).setDefaultValue(true).setSaveConsumer(newValue -> settings.reacharound = newValue).build());
reachAround.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.reachAround.multiplayer"), settings.reacharoundMultiplayer).setDefaultValue(true).setSaveConsumer(newValue -> settings.reacharoundMultiplayer = newValue).build());
reachAround.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.reachAround.sneaking"), settings.reacharoundSneaking).setDefaultValue(true).setSaveConsumer(newValue -> settings.reacharoundSneaking = newValue).build());
reachAround.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.reachAround.indicator"), settings.reacharoundIndicator).setDefaultValue(true).setSaveConsumer(newValue -> settings.reacharoundIndicator = newValue).build());
reachAround.add(entryBuilder.startIntSlider(new TranslatableText("bedrockify.options.reachAround.pitch"), settings.reacharoundPitchAngle, 0, 90).setDefaultValue(25).setSaveConsumer(newValue -> settings.reacharoundPitchAngle = newValue).build());
reachAround.add(entryBuilder.startIntSlider(new TranslatableText("bedrockify.options.reachAround.distance"), MathHelper.floor(settings.reacharoundBlockDistance * 100), 0, 100).setTextGetter((integer -> new LiteralText(String.valueOf(integer / 100d)))).setDefaultValue(75).setSaveConsumer(newValue -> settings.reacharoundBlockDistance = newValue / 100d).build());
general.addEntry(reachAround.build());
SubCategoryBuilder otherSettings = entryBuilder.startSubCategory(new TranslatableText("bedrockify.options.subCategory.other"));
otherSettings.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.loadingScreenChunkMap"), settings.showChunkMap).setTooltip(wrapLines(new TranslatableText("bedrockify.options.loadingScreenChunkMap.tooltip"))).setDefaultValue(false).setSaveConsumer(newValue -> settings.showChunkMap = newValue).build());
otherSettings.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.rotationalBackground"), settings.cubeMapBackground).setDefaultValue(true).setTooltip(wrapLines(new TranslatableText("bedrockify.options.rotationalBackground.tooltip"))).setSaveConsumer(newValue -> settings.cubeMapBackground = newValue).build());
otherSettings.add(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.showBedrockIfyButton"), settings.bedrockIfyButton).setDefaultValue(true).setTooltip(wrapLines(new TranslatableText("bedrockify.options.showBedrockIfyButton.tooltip"))).setSaveConsumer(newValue -> settings.bedrockIfyButton = newValue).build());
general.addEntry(otherSettings.build());
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("bedrockify.options.recipes"), settings.bedrockRecipes).setTooltip(wrapLines(new TranslatableText("bedrockify.options.recipes.tooltip"))).setDefaultValue(true).setSaveConsumer(newValue -> settings.bedrockRecipes = newValue).build());
return builder.setTransparentBackground(isTransparent).build();
}
use of me.shedaniel.clothconfig2.api.ConfigBuilder in project Hyper-Lighting by Exploding-Creeper.
the class ClothConfigGUI method openGUI.
public static Screen openGUI(Screen screen) {
ConfigBuilder builder = ConfigBuilder.create().setParentScreen(screen).setTitle(new StringTextComponent("Hyper Lighting Config"));
ConfigCategory torch_config = builder.getOrCreateCategory(new StringTextComponent("Torch Config"));
ConfigEntryBuilder configEntryBuilder = builder.entryBuilder();
torch_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.torchColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.torchColor.set(newValue)).build());
torch_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.torchOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.torchOnByDefault.set(newValue)).build());
ConfigCategory lantern_config = builder.getOrCreateCategory(new StringTextComponent("Lantern Config"));
lantern_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.lanternColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.lanternColor.set(newValue)).build());
lantern_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.lanternOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.lanternOnByDefault.set(newValue)).build());
ConfigCategory tiki_torch_config = builder.getOrCreateCategory(new StringTextComponent("Tiki Torch Config"));
tiki_torch_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.tikiColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.tikiColor.set(newValue)).build());
tiki_torch_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.tikiOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.tikiOnByDefault.set(newValue)).build());
ConfigCategory candle_config = builder.getOrCreateCategory(new StringTextComponent("Candle Config"));
candle_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.candleColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.candleColor.set(newValue)).build());
candle_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.candleOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.candleOnByDefault.set(newValue)).build());
ConfigCategory redstone_config = builder.getOrCreateCategory(new StringTextComponent("Redstone Config"));
redstone_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.redstoneColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.redstoneColor.set(newValue)).build());
ConfigCategory battery_lights_config = builder.getOrCreateCategory(new StringTextComponent("Battery Lights Config"));
battery_lights_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.batteryColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.batteryColor.set(newValue)).build());
battery_lights_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.batteryOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.batteryOnByDefault.set(newValue)).build());
ConfigCategory campfire_config = builder.getOrCreateCategory(new StringTextComponent("Campfire Config"));
campfire_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.campfireColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.campfireColor.set(newValue)).build());
campfire_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.campfireOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.campfireOnByDefault.set(newValue)).build());
ConfigCategory jack_o_lantern_config = builder.getOrCreateCategory(new StringTextComponent("Jack O Lantern Config"));
jack_o_lantern_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.jackColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.jackColor.set(newValue)).build());
jack_o_lantern_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.jackOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.jackOnByDefault.set(newValue)).build());
ConfigCategory underwater_lights_config = builder.getOrCreateCategory(new StringTextComponent("Underwater Lights Config"));
underwater_lights_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Disabled Colored Lighting"), HyperLightingConfig.underwaterColor.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Enable/Disable Colored Lighting Support")).setSaveConsumer(newValue -> HyperLightingConfig.underwaterColor.set(newValue)).build());
underwater_lights_config.addEntry(configEntryBuilder.startBooleanToggle(new StringTextComponent("Lit By Default"), HyperLightingConfig.underwaterOnByDefault.get()).setDefaultValue(false).setTooltip(new StringTextComponent("Should Lights be lit when placed")).setSaveConsumer(newValue -> HyperLightingConfig.underwaterOnByDefault.set(newValue)).build());
return builder.build();
}
use of me.shedaniel.clothconfig2.api.ConfigBuilder in project Debugify by W-OVERFLOW.
the class ConfigGuiHelper method createConfigGui.
public static Screen createConfigGui(DebugifyConfig config, Screen parent) {
ConfigBuilder builder = ConfigBuilder.create().setTitle(new LiteralText("Debugify")).setSavingRunnable(config::save).setParentScreen(parent);
ConfigCategory category = builder.getOrCreateCategory(new LiteralText("Fixes"));
config.getBugFixes().forEach((bug, enabled) -> {
AbstractConfigListEntry<?> entry = builder.entryBuilder().startBooleanToggle(new LiteralText(bug), enabled).setSaveConsumer((toggled) -> config.getBugFixes().replace(bug, toggled)).setDefaultValue(true).requireRestart().build();
category.addEntry(entry);
});
return builder.build();
}
Aggregations