Search in sources :

Example 1 with LongListEntry

use of me.shedaniel.clothconfig2.gui.entries.LongListEntry in project canvas by vram-guild.

the class Configurator method display.

@SuppressWarnings({ "unchecked", "rawtypes" })
private static Screen display() {
    reloadTerrain = false;
    reloadShaders = false;
    final ConfigBuilder builder = ConfigBuilder.create().setParentScreen(screenIn).setTitle("config.canvas.title").setSavingRunnable(Configurator::saveUserInput);
    // FEATURES
    final ConfigCategory features = builder.getOrCreateCategory("config.canvas.category.features");
    features.addEntry(new BooleanListEntry("config.canvas.value.item_render", itemShaderRender, "config.canvas.reset", () -> DEFAULTS.itemShaderRender, b -> itemShaderRender = b, () -> Optional.of(I18n.translate("config.canvas.help.item_render").split(";"))));
    features.addEntry(new BooleanListEntry("config.canvas.value.hardcore_darkness", hardcoreDarkness, "config.canvas.reset", () -> DEFAULTS.hardcoreDarkness, b -> {
        hardcoreDarkness = b;
        reloadShaders = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.hardcore_darkness").split(";"))));
    features.addEntry(new BooleanListEntry("config.canvas.value.subtle_fog", subtleFog, "config.canvas.reset", () -> DEFAULTS.subtleFog, b -> {
        subtleFog = b;
        reloadShaders = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.subtle_fog").split(";"))));
    // LIGHTING
    final ConfigCategory lighting = builder.getOrCreateCategory("config.canvas.category.lighting");
    lighting.addEntry(new BooleanListEntry("config.canvas.value.light_smoothing", lightSmoothing, "config.canvas.reset", () -> DEFAULTS.lightSmoothing, b -> {
        lightSmoothing = b;
        reloadTerrain = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.light_smoothing").split(";"))));
    lighting.addEntry(new BooleanListEntry("config.canvas.value.hd_lightmaps", hdLightmaps, "config.canvas.reset", () -> DEFAULTS.hdLightmaps, b -> {
        hdLightmaps = b;
        reloadTerrain = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.hd_lightmaps").split(";"))));
    lighting.addEntry(new BooleanListEntry("config.canvas.value.more_lightmap", moreLightmap, "config.canvas.reset", () -> DEFAULTS.moreLightmap, b -> moreLightmap = b, () -> Optional.of(I18n.translate("config.canvas.help.more_lightmap").split(";"))));
    lighting.addEntry(new BooleanListEntry("config.canvas.value.lightmap_noise", lightmapNoise, "config.canvas.reset", () -> DEFAULTS.lightmapNoise, b -> {
        lightmapNoise = b;
        reloadShaders = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.lightmap_noise").split(";"))));
    lighting.addEntry(new EnumListEntry("config.canvas.value.diffuse_shading", DiffuseMode.class, diffuseShadingMode, "config.canvas.reset", () -> DEFAULTS.diffuseShadingMode, (b) -> {
        diffuseShadingMode = (DiffuseMode) b;
        reloadShaders = true;
    }, a -> a.toString(), () -> Optional.of(I18n.translate("config.canvas.help.diffuse_shading").split(";"))));
    lighting.addEntry(new EnumListEntry("config.canvas.value.ao_shading", AoMode.class, aoShadingMode, "config.canvas.reset", () -> DEFAULTS.aoShadingMode, (b) -> {
        aoShadingMode = (AoMode) b;
        reloadShaders = true;
    }, a -> a.toString(), () -> Optional.of(I18n.translate("config.canvas.help.ao_shading").split(";"))));
    lighting.addEntry(new IntegerSliderEntry("config.canvas.value.lightmap_delay_frames", 0, 20, maxLightmapDelayFrames, "config.canvas.reset", () -> DEFAULTS.maxLightmapDelayFrames, b -> maxLightmapDelayFrames = b, () -> Optional.of(I18n.translate("config.canvas.help.lightmap_delay_frames").split(";"))));
    // TWEAKS
    final ConfigCategory tweaks = builder.getOrCreateCategory("config.canvas.category.tweaks");
    // tweaks.addOption(new BooleanListEntry("config.canvas.value.compact_gpu_formats", enableCompactGPUFormats, "config.canvas.reset",
    // () -> DEFAULTS.enableCompactGPUFormats, b -> enableCompactGPUFormats = b,
    // () -> Optional.of(I18n.translate("config.canvas.help.compact_gpu_formats").split(";"))));
    tweaks.addEntry(new LongListEntry("config.canvas.value.min_chunk_budget", minChunkBudgetNanos, "config.canvas.reset", () -> DEFAULTS.minChunkBudgetNanos, l -> minChunkBudgetNanos = l, () -> Optional.of(I18n.translate("config.canvas.help.min_chunk_budget").split(";"))));
    tweaks.addEntry(new BooleanListEntry("config.canvas.value.chunk_occlusion", fastChunkOcclusion, "config.canvas.reset", () -> DEFAULTS.fastChunkOcclusion, b -> fastChunkOcclusion = b, () -> Optional.of(I18n.translate("config.canvas.help.chunk_occlusion").split(";"))));
    tweaks.addEntry(new BooleanListEntry("config.canvas.value.batch_chunk_render", batchedChunkRender, "config.canvas.reset", () -> DEFAULTS.batchedChunkRender, b -> batchedChunkRender = b, () -> Optional.of(I18n.translate("config.canvas.help.batch_chunk_render").split(";"))));
    // tweaks.addOption(new BooleanListEntry("config.canvas.value.vanilla_chunk_matrix", disableVanillaChunkMatrix, "config.canvas.reset",
    // () -> DEFAULTS.disableVanillaChunkMatrix, b -> disableVanillaChunkMatrix = b,
    // () -> Optional.of(I18n.translate("config.canvas.help.vanilla_chunk_matrix").split(";"))));
    tweaks.addEntry(new BooleanListEntry("config.canvas.value.adjust_vanilla_geometry", preventDepthFighting, "config.canvas.reset", () -> DEFAULTS.preventDepthFighting, b -> {
        preventDepthFighting = b;
        reloadTerrain = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.adjust_vanilla_geometry").split(";"))));
    tweaks.addEntry(new BooleanListEntry("config.canvas.value.clamp_exterior_vertices", clampExteriorVertices, "config.canvas.reset", () -> DEFAULTS.clampExteriorVertices, b -> {
        clampExteriorVertices = b;
        reloadTerrain = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.clamp_exterior_vertices").split(";"))));
    tweaks.addEntry(new BooleanListEntry("config.canvas.value.fix_luminous_block_shade", fixLuminousBlockShading, "config.canvas.reset", () -> DEFAULTS.fixLuminousBlockShading, b -> {
        fixLuminousBlockShading = b;
        reloadTerrain = true;
    }, () -> Optional.of(I18n.translate("config.canvas.help.fix_luminous_block_shade").split(";"))));
    // tweaks.addOption(new BooleanListEntry("config.canvas.value.pad_translucent_formats", padTranslucentFormats, "config.canvas.reset",
    // () -> DEFAULTS.padTranslucentFormats, b -> {padTranslucentFormats = b; reloadTerrain = true;},
    // () -> Optional.of(I18n.translate("config.canvas.help.pad_translucent_formats").split(";"))));
    // DEBUG
    final ConfigCategory debug = builder.getOrCreateCategory("config.canvas.category.debug");
    debug.addEntry(new BooleanListEntry("config.canvas.value.shader_debug", shaderDebug, "config.canvas.reset", () -> DEFAULTS.shaderDebug, b -> shaderDebug = b, () -> Optional.of(I18n.translate("config.canvas.help.shader_debug").split(";"))));
    debug.addEntry(new BooleanListEntry("config.canvas.value.shader_debug_lightmap", lightmapDebug, "config.canvas.reset", () -> DEFAULTS.lightmapDebug, b -> lightmapDebug = b, () -> Optional.of(I18n.translate("config.canvas.help.shader_debug_lightmap").split(";"))));
    debug.addEntry(new BooleanListEntry("config.canvas.value.concise_errors", conciseErrors, "config.canvas.reset", () -> DEFAULTS.conciseErrors, b -> conciseErrors = b, () -> Optional.of(I18n.translate("config.canvas.help.concise_errors").split(";"))));
    debug.addEntry(new BooleanListEntry("config.canvas.value.log_machine_info", logMachineInfo, "config.canvas.reset", () -> DEFAULTS.logMachineInfo, b -> logMachineInfo = b, () -> Optional.of(I18n.translate("config.canvas.help.log_machine_info").split(";"))));
    debug.addEntry(new BooleanListEntry("config.canvas.value.log_gl_state_changes", logGlStateChanges, "config.canvas.reset", () -> DEFAULTS.logGlStateChanges, b -> logGlStateChanges = b, () -> Optional.of(I18n.translate("config.canvas.help.log_gl_state_changes").split(";"))));
    debug.addEntry(new BooleanListEntry("config.canvas.value.debug_native_allocation", debugNativeMemoryAllocation, "config.canvas.reset", () -> DEFAULTS.debugNativeMemoryAllocation, b -> debugNativeMemoryAllocation = b, () -> Optional.of(I18n.translate("config.canvas.help.debug_native_allocation").split(";"))));
    debug.addEntry(new BooleanListEntry("config.canvas.value.safe_native_allocation", safeNativeMemoryAllocation, "config.canvas.reset", () -> DEFAULTS.safeNativeMemoryAllocation, b -> safeNativeMemoryAllocation = b, () -> Optional.of(I18n.translate("config.canvas.help.safe_native_allocation").split(";"))));
    builder.setDoesConfirmSave(false);
    return builder.build();
}
Also used : FabricLoader(net.fabricmc.loader.api.FabricLoader) JsonObject(blue.endless.jankson.JsonObject) IntegerSliderEntry(me.shedaniel.clothconfig2.gui.entries.IntegerSliderEntry) EnumListEntry(me.shedaniel.clothconfig2.gui.entries.EnumListEntry) I18n(net.minecraft.client.resource.language.I18n) Environment(net.fabricmc.api.Environment) FileOutputStream(java.io.FileOutputStream) Jankson(blue.endless.jankson.Jankson) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) LongListEntry(me.shedaniel.clothconfig2.gui.entries.LongListEntry) Supplier(java.util.function.Supplier) File(java.io.File) GsonBuilder(com.google.gson.GsonBuilder) ShaderManager(grondag.canvas.material.ShaderManager) Screen(net.minecraft.client.gui.screen.Screen) Comment(blue.endless.jankson.Comment) Gson(com.google.gson.Gson) Optional(java.util.Optional) EnvType(net.fabricmc.api.EnvType) MinecraftClient(net.minecraft.client.MinecraftClient) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) BooleanListEntry(me.shedaniel.clothconfig2.gui.entries.BooleanListEntry) LongListEntry(me.shedaniel.clothconfig2.gui.entries.LongListEntry) IntegerSliderEntry(me.shedaniel.clothconfig2.gui.entries.IntegerSliderEntry) ConfigCategory(me.shedaniel.clothconfig2.api.ConfigCategory) EnumListEntry(me.shedaniel.clothconfig2.gui.entries.EnumListEntry) ConfigBuilder(me.shedaniel.clothconfig2.api.ConfigBuilder) BooleanListEntry(me.shedaniel.clothconfig2.gui.entries.BooleanListEntry)

Aggregations

Comment (blue.endless.jankson.Comment)1 Jankson (blue.endless.jankson.Jankson)1 JsonObject (blue.endless.jankson.JsonObject)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 ShaderManager (grondag.canvas.material.ShaderManager)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 Optional (java.util.Optional)1 Supplier (java.util.function.Supplier)1 ConfigBuilder (me.shedaniel.clothconfig2.api.ConfigBuilder)1 ConfigCategory (me.shedaniel.clothconfig2.api.ConfigCategory)1 BooleanListEntry (me.shedaniel.clothconfig2.gui.entries.BooleanListEntry)1 EnumListEntry (me.shedaniel.clothconfig2.gui.entries.EnumListEntry)1 IntegerSliderEntry (me.shedaniel.clothconfig2.gui.entries.IntegerSliderEntry)1 LongListEntry (me.shedaniel.clothconfig2.gui.entries.LongListEntry)1 EnvType (net.fabricmc.api.EnvType)1 Environment (net.fabricmc.api.Environment)1 FabricLoader (net.fabricmc.loader.api.FabricLoader)1 MinecraftClient (net.minecraft.client.MinecraftClient)1