Search in sources :

Example 1 with Finder

use of kaptainwutax.seedcrackerX.finder.Finder 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)

Aggregations

HashedSeedData (kaptainwutax.seedcrackerX.cracker.HashedSeedData)1 Finder (kaptainwutax.seedcrackerX.finder.Finder)1 ConfigBuilder (me.shedaniel.clothconfig2.api.ConfigBuilder)1 ConfigCategory (me.shedaniel.clothconfig2.api.ConfigCategory)1 ConfigEntryBuilder (me.shedaniel.clothconfig2.api.ConfigEntryBuilder)1 SubCategoryBuilder (me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder)1 LiteralText (net.minecraft.text.LiteralText)1 TranslatableText (net.minecraft.text.TranslatableText)1 Identifier (net.minecraft.util.Identifier)1