Search in sources :

Example 1 with ConfigEntryBuilder

use of me.shedaniel.clothconfig2.api.ConfigEntryBuilder in project SeedcrackerX by 19MisterX98.

the class ConfigScreen method getConfigScreenByCloth.

public Screen getConfigScreenByCloth(Screen parent) {
    ConfigBuilder builder = ConfigBuilder.create().setParentScreen(parent).setTitle(new TranslatableText("title")).setDefaultBackgroundTexture(new Identifier("minecraft:textures/block/blackstone.png")).setTransparentBackground(true);
    ConfigEntryBuilder eb = builder.entryBuilder();
    // =============================CONFIG========================
    ConfigCategory settings = builder.getOrCreateCategory(new TranslatableText("settings"));
    settings.addEntry(eb.startBooleanToggle(new TranslatableText("settings.active"), config.active).setSaveConsumer(val -> config.active = val).build());
    settings.addEntry(eb.startBooleanToggle(new TranslatableText("settings.database"), config.databaseSubmits).setTooltip(new TranslatableText("settings.database.tooltip")).setSaveConsumer(val -> config.databaseSubmits = val).build());
    settings.addEntry(eb.startBooleanToggle(new TranslatableText("settings.hideNameDatabase"), config.anonymusSubmits).setSaveConsumer(val -> config.anonymusSubmits = val).build());
    settings.addEntry(eb.startDropdownMenu(new TranslatableText("settings.version"), DropdownMenuBuilder.TopCellElementBuilder.of(config.getVersion(), MCVersion::fromString)).setSelections(getSupportedVersions()).setSuggestionMode(false).setDefaultValue(config.getVersion()).setSaveConsumer(config::setVersion).build());
    settings.addEntry(eb.startTextDescription(new LiteralText("==============")).build());
    settings.addEntry(eb.startTextDescription(new TranslatableText("settings.visuals")).build());
    settings.addEntry(eb.startEnumSelector(new TranslatableText("settings.outline"), Config.RenderType.class, config.render).setSaveConsumer(val -> config.render = val).build());
    settings.addEntry(eb.startTextDescription(new LiteralText("==============")).build());
    settings.addEntry(eb.startTextDescription((new TranslatableText("settings.finderToggles"))).build());
    for (Finder.Type finder : Finder.Type.values()) {
        settings.addEntry(eb.startBooleanToggle(new TranslatableText(finder.nameKey), finder.enabled.get()).setSaveConsumer(val -> finder.enabled.set(val)).build());
    }
    settings.addEntry(eb.startTextDescription(new LiteralText("==============")).build());
    settings.addEntry(eb.startBooleanToggle(new TranslatableText("settings.antiXrayMode"), config.antiXrayBypass).setSaveConsumer(val -> config.antiXrayBypass = val).build());
    settings.addEntry(eb.startTextDescription(new TranslatableText("settings.antiAntiXrayExplained")).build());
    // =============================INFO========================
    ConfigCategory info = builder.getOrCreateCategory(new TranslatableText("info"));
    // Clear data
    info.addEntry(eb.startBooleanToggle(new TranslatableText("info.clearData"), false).setSaveConsumer(val -> {
        if (val) {
            SeedCracker.get().reset();
        }
    }).build());
    // List worldseeds
    Set<Long> worldSeeds = SeedCracker.get().getDataStorage().getTimeMachine().worldSeeds;
    if (!worldSeeds.isEmpty()) {
        SubCategoryBuilder world = eb.startSubCategory(new TranslatableText("info.worldSeeds"));
        for (long worldSeed : worldSeeds) {
            world.add(eb.startTextField(new LiteralText(""), String.valueOf(worldSeed)).build());
        }
        info.addEntry(world.setExpanded(true).build());
    } else {
        info.addEntry(eb.startTextDescription(new TranslatableText("info.noWorldSeeds")).build());
    }
    // List structureseeds
    Set<Long> structureSeeds = SeedCracker.get().getDataStorage().getTimeMachine().structureSeeds;
    if (!structureSeeds.isEmpty()) {
        SubCategoryBuilder struc = eb.startSubCategory(new TranslatableText("info.structureSeeds"));
        for (long structureSeed : structureSeeds) {
            struc.add(eb.startTextField(new LiteralText(""), String.valueOf(structureSeed)).build());
        }
        info.addEntry(struc.setExpanded(true).build());
    } else {
        info.addEntry(eb.startTextDescription(new TranslatableText("info.noStructureSeeds")).build());
    }
    if (config.debug) {
        // List pillarseeds
        List<Integer> pillarSeeds = SeedCracker.get().getDataStorage().getTimeMachine().pillarSeeds;
        if (pillarSeeds != null) {
            SubCategoryBuilder pillar = eb.startSubCategory(new TranslatableText("info.pillarSeeds"));
            for (long structureSeed : pillarSeeds) {
                pillar.add(eb.startTextField(new LiteralText(""), String.valueOf(structureSeed)).build());
            }
            info.addEntry(pillar.setExpanded(true).build());
        } else {
            info.addEntry(eb.startTextDescription(new TranslatableText("info.noPillarSeeds")).build());
        }
        // Hashed seed
        HashedSeedData hashedSeed = SeedCracker.get().getDataStorage().hashedSeedData;
        if (hashedSeed != null) {
            info.addEntry(eb.startTextField(new TranslatableText("info.hashedSeed"), String.valueOf(hashedSeed.getHashedSeed())).build());
        } else {
            info.addEntry(eb.startTextDescription(new TranslatableText("info.noHashedSeed")).build());
        }
    }
    builder.setSavingRunnable(Config::save);
    return builder.build();
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) Finder(kaptainwutax.seedcrackerX.finder.Finder) HashedSeedData(kaptainwutax.seedcrackerX.cracker.HashedSeedData) SubCategoryBuilder(me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder) Identifier(net.minecraft.util.Identifier) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) ConfigEntryBuilder(me.shedaniel.clothconfig2.api.ConfigEntryBuilder) LiteralText(net.minecraft.text.LiteralText)

Example 2 with ConfigEntryBuilder

use of me.shedaniel.clothconfig2.api.ConfigEntryBuilder in project mineclub-expanded by Blobanium.

the class ClothConfigScreen method createConfig.

public static Screen createConfig(Screen parent) {
    final ConfigBuilder builder = ConfigBuilder.create().setParentScreen(parent).setTitle(new TranslatableText("mineclub-expanded.config"));
    // Serialise the config into the config file. This will be called last after all variables are updated.
    builder.setSavingRunnable(ConfigReader::onConfigSave);
    ConfigEntryBuilder entryBuilder = builder.entryBuilder();
    ConfigCategory general = builder.getOrCreateCategory(new TranslatableText("mineclub-expanded.category.main"));
    ConfigCategory presence = builder.getOrCreateCategory(new TranslatableText("mineclub-expanded.category.presence"));
    ConfigCategory outbid = builder.getOrCreateCategory(new TranslatableText("mineclub-expanded.category.outbid"));
    ConfigCategory autoreconnect = builder.getOrCreateCategory(new TranslatableText("mineclub-expanded.category.autoreconnect"));
    ConfigCategory serial = builder.getOrCreateCategory(new TranslatableText("mineclub-expanded.category.serial"));
    general.addEntry(entryBuilder.startBooleanToggle(DynamicModMenuTranslatable.getDiscordRPTranslatable(), ConfigReader.richPresence).setDefaultValue(false).setTooltip(DynamicModMenuTranslatable.getDiscordRPDescriptionTranslatable()).requireRestart().setSaveConsumer(newValue -> ConfigReader.richPresence = newValue).build());
    presence.addEntry(entryBuilder.startStringDropdownMenu(new TranslatableText("mineclub-expanded.config.presencedetail"), ConfigReader.rpCustomDetails).setDefaultValue("Compact").setSuggestionMode(false).setSelections(Lists.newArrayList("Compact", "ServerIP", "Username", "Mod Version")).setTooltip(new TranslatableText("mineclub-expanded.config.presencedetail.description")).setSaveConsumer(newValue -> ConfigReader.rpCustomDetails = newValue).build());
    presence.addEntry(entryBuilder.startTextDescription(new TranslatableText("mineclub-expanded.configtext.presence")).build());
    general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("mineclub-expanded.config.outbidsound"), ConfigReader.outbidNotification).setDefaultValue(false).setTooltip(new TranslatableText("mineclub-expanded.config.outbidsound.description")).setSaveConsumer(newValue -> ConfigReader.outbidNotification = newValue).build());
    outbid.addEntry(entryBuilder.startIntSlider(new TranslatableText("mineclub-expanded.config.outbidvolume"), ConfigReader.outbidVolume, 0, 200).setDefaultValue(100).setTooltip(new TranslatableText("mineclub-expanded.config.outbidvolume.description")).setSaveConsumer(newValue -> ConfigReader.outbidVolume = newValue).build());
    outbid.addEntry(entryBuilder.startTextDescription(new TranslatableText("mineclub-expanded.configtext.outbid")).build());
    general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("mineclub-expanded.config.autogg"), ConfigReader.autogg).setDefaultValue(false).setTooltip(new TranslatableText("mineclub-expanded.config.autogg.description")).setSaveConsumer(newValue -> ConfigReader.autogg = newValue).build());
    general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("mineclub-expanded.config.autoreconnect"), ConfigReader.autoReconnect).setDefaultValue(false).setTooltip(new TranslatableText("mineclub-expanded.config.autoreconnect.description")).setSaveConsumer(newValue -> ConfigReader.autoReconnect = newValue).build());
    autoreconnect.addEntry(entryBuilder.startIntSlider(new TranslatableText("mineclub-expanded.config.autoreconnectattempts"), ConfigReader.autoReconnectAttempts, 1, 20).setDefaultValue(3).setTooltip(new TranslatableText("mineclub-expanded.config.autoreconnectattempts.description")).setSaveConsumer(newValue -> ConfigReader.autoReconnectAttempts = newValue).build());
    autoreconnect.addEntry(entryBuilder.startIntSlider(new TranslatableText("mineclub-expanded.config.autoreconnectseconds"), ConfigReader.autoReconnectSeconds, 1, 60).setDefaultValue(5).setTooltip(new TranslatableText("mineclub-expanded.config.autoreconnectseconds.description")).setSaveConsumer(newValue -> ConfigReader.autoReconnectSeconds = newValue).build());
    autoreconnect.addEntry(entryBuilder.startTextDescription(new TranslatableText("mineclub-expanded.configtext.autoreconnect")).build());
    general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("mineclub-expanded.config.expressconnect"), ConfigReader.expressConnect).setDefaultValue(false).setTooltip(new TranslatableText("mineclub-expanded.config.expressconnect.description")).setSaveConsumer(newValue -> ConfigReader.expressConnect = newValue).build());
    general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("mineclub-expanded.config.hideserialid"), ConfigReader.hideSerialID).setDefaultValue(false).setTooltip(new TranslatableText("mineclub-expanded.config.hideserialid.description")).setSaveConsumer(newValue -> ConfigReader.hideSerialID = newValue).build());
    serial.addEntry(entryBuilder.startStringDropdownMenu(new TranslatableText("mineclub-expanded.config.serialcolor"), ConfigReader.serialColor).setDefaultValue("White").setSuggestionMode(false).setSelections(Lists.newArrayList("White", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow")).setTooltip(new TranslatableText("mineclub-expanded.config.serialcolor.description")).setSaveConsumer(newValue -> ConfigReader.serialColor = newValue).build());
    serial.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("mineclub-expanded.config.showdigits"), ConfigReader.showDigits).setDefaultValue(false).setTooltip(new TranslatableText("mineclub-expanded.config.showdigits.description")).setSaveConsumer(newValue -> ConfigReader.showDigits = newValue).build());
    if (MineclubExpanded.debugmode) {
        ConfigCategory debug = builder.getOrCreateCategory(new TranslatableText("mineclub-expanded.category.debug"));
        debug.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("mineclub-expanded.config.debug.asyncticks"), ConfigReader.debugAsyncTicks).setDefaultValue(false).setTooltip(new TranslatableText("mineclub-expanded.config.debug.asyncticks.description")).setSaveConsumer(newValue -> ConfigReader.debugAsyncTicks = newValue).build());
        debug.addEntry(entryBuilder.startIntSlider(new TranslatableText("mineclub-expanded.config.debug.asynctickthreads"), ConfigReader.debugAsyncTickThreads, 1, Runtime.getRuntime().availableProcessors()).setDefaultValue(2).setTooltip(new TranslatableText("mineclub-expanded.config.debug.asynctickthreads.description")).setSaveConsumer(newValue -> ConfigReader.debugAsyncTickThreads = newValue).build());
    }
    return builder.build();
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) ConfigEntryBuilder(me.shedaniel.clothconfig2.api.ConfigEntryBuilder)

Example 3 with ConfigEntryBuilder

use of me.shedaniel.clothconfig2.api.ConfigEntryBuilder in project CITResewn by SHsuperCM.

the class CITResewnConfigScreenFactory method create.

public static Screen create(Screen parent) {
    CITResewnConfig currentConfig = CITResewnConfig.INSTANCE(), defaultConfig = new CITResewnConfig();
    ConfigBuilder builder = ConfigBuilder.create().setParentScreen(parent).setTitle(new TranslatableText("config.citresewn.title")).setSavingRunnable(currentConfig::write);
    ConfigCategory category = builder.getOrCreateCategory(new LiteralText(""));
    ConfigEntryBuilder entryBuilder = builder.entryBuilder();
    category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.enabled.title"), currentConfig.enabled).setTooltip(new TranslatableText("config.citresewn.enabled.tooltip")).setSaveConsumer(newConfig -> {
        if (currentConfig.enabled != newConfig) {
            currentConfig.enabled = newConfig;
            MinecraftClient.getInstance().reloadResources();
        }
    }).setDefaultValue(defaultConfig.enabled).build());
    category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.mute_errors.title"), currentConfig.mute_errors).setTooltip(new TranslatableText("config.citresewn.mute_errors.tooltip")).setSaveConsumer(newConfig -> currentConfig.mute_errors = newConfig).setDefaultValue(defaultConfig.mute_errors).build());
    category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.mute_warns.title"), currentConfig.mute_warns).setTooltip(new TranslatableText("config.citresewn.mute_warns.tooltip")).setSaveConsumer(newConfig -> currentConfig.mute_warns = newConfig).setDefaultValue(defaultConfig.mute_warns).build());
    category.addEntry(entryBuilder.startFloatField(new TranslatableText("config.citresewn.citenchantment_scroll_multiplier.title"), currentConfig.citenchantment_scroll_multiplier).setTooltip(new TranslatableText("config.citresewn.citenchantment_scroll_multiplier.tooltip")).setSaveConsumer(newConfig -> currentConfig.citenchantment_scroll_multiplier = newConfig).setDefaultValue(defaultConfig.citenchantment_scroll_multiplier).setMin(0f).build());
    category.addEntry(entryBuilder.startIntSlider(new TranslatableText("config.citresewn.cache_ms.title"), currentConfig.cache_ms / 50, 0, 5 * 20).setTooltip(new TranslatableText("config.citresewn.cache_ms.tooltip")).setSaveConsumer(newConfig -> currentConfig.cache_ms = newConfig * 50).setDefaultValue(currentConfig.cache_ms / 50).setTextGetter(ticks -> {
        if (ticks <= 1)
            return new TranslatableText("config.citresewn.cache_ms.ticks." + ticks).formatted(Formatting.AQUA);
        Formatting color = Formatting.DARK_RED;
        if (ticks <= 40)
            color = Formatting.RED;
        if (ticks <= 20)
            color = Formatting.GOLD;
        if (ticks <= 10)
            color = Formatting.DARK_GREEN;
        if (ticks <= 5)
            color = Formatting.GREEN;
        return new TranslatableText("config.citresewn.cache_ms.ticks.any", ticks).formatted(color);
    }).build());
    category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.broken_paths.title"), currentConfig.broken_paths).setTooltip(new TranslatableText("config.citresewn.broken_paths.tooltip")).setSaveConsumer(newConfig -> currentConfig.broken_paths = newConfig).setDefaultValue(defaultConfig.broken_paths).requireRestart().build());
    return builder.build();
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) LiteralText(net.minecraft.text.LiteralText) Formatting(net.minecraft.util.Formatting) Screen(net.minecraft.client.gui.screen.Screen) TranslatableText(net.minecraft.text.TranslatableText) MinecraftClient(net.minecraft.client.MinecraftClient) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) ConfigEntryBuilder(me.shedaniel.clothconfig2.api.ConfigEntryBuilder) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) Formatting(net.minecraft.util.Formatting) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) ConfigEntryBuilder(me.shedaniel.clothconfig2.api.ConfigEntryBuilder) LiteralText(net.minecraft.text.LiteralText)

Example 4 with ConfigEntryBuilder

use of me.shedaniel.clothconfig2.api.ConfigEntryBuilder 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();
}
Also used : BedrockifySettings(me.juancarloscp52.bedrockify.BedrockifySettings) SubCategoryBuilder(me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder) List(java.util.List) Screen(net.minecraft.client.gui.screen.Screen) Bedrockify(me.juancarloscp52.bedrockify.Bedrockify) MathHelper(net.minecraft.util.math.MathHelper) MinecraftClient(net.minecraft.client.MinecraftClient) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) net.minecraft.text(net.minecraft.text) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) ConfigEntryBuilder(me.shedaniel.clothconfig2.api.ConfigEntryBuilder) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) ConfigEntryBuilder(me.shedaniel.clothconfig2.api.ConfigEntryBuilder) SubCategoryBuilder(me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder)

Example 5 with ConfigEntryBuilder

use of me.shedaniel.clothconfig2.api.ConfigEntryBuilder in project frame-fabric by moddingplayground.

the class Config method addConfigListEntries.

@Environment(EnvType.CLIENT)
public void addConfigListEntries(ConfigEntryBuilder entryBuilder, Supplier<ConfigCategory> categoryCreator) {
    if (this.canDisplayInMenu()) {
        ConfigCategory category = categoryCreator.get();
        for (Map.Entry<Identifier, Option<?>> entry : this.getDisplayedOptions().entrySet()) {
            Identifier id = entry.getKey();
            Option<?> option = entry.getValue();
            option.addConfigEntries(category, id, entryBuilder);
        }
    }
}
Also used : Identifier(net.minecraft.util.Identifier) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) StandardCopyOption(java.nio.file.StandardCopyOption) Option(net.moddingplayground.frame.api.config.v0.option.Option) Map(java.util.Map) HashBiMap(com.google.common.collect.HashBiMap) Environment(net.fabricmc.api.Environment)

Aggregations

ConfigCategory (me.shedaniel.clothconfig2.api.ConfigCategory)6 ConfigBuilder (me.shedaniel.clothconfig2.api.ConfigBuilder)5 ConfigEntryBuilder (me.shedaniel.clothconfig2.api.ConfigEntryBuilder)5 TranslatableText (net.minecraft.text.TranslatableText)3 SubCategoryBuilder (me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder)2 MinecraftClient (net.minecraft.client.MinecraftClient)2 Screen (net.minecraft.client.gui.screen.Screen)2 LiteralText (net.minecraft.text.LiteralText)2 Identifier (net.minecraft.util.Identifier)2 HashBiMap (com.google.common.collect.HashBiMap)1 StandardCopyOption (java.nio.file.StandardCopyOption)1 List (java.util.List)1 Map (java.util.Map)1 HashedSeedData (kaptainwutax.seedcrackerX.cracker.HashedSeedData)1 Finder (kaptainwutax.seedcrackerX.finder.Finder)1 Bedrockify (me.juancarloscp52.bedrockify.Bedrockify)1 BedrockifySettings (me.juancarloscp52.bedrockify.BedrockifySettings)1 Environment (net.fabricmc.api.Environment)1 net.minecraft.text (net.minecraft.text)1 Formatting (net.minecraft.util.Formatting)1