use of me.shedaniel.clothconfig2.gui.entries.IntegerSliderEntry 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();
}
use of me.shedaniel.clothconfig2.gui.entries.IntegerSliderEntry in project fallingleaves by RandomMcSomethin.
the class LeafSettingsGuiProvider method buildSpawnRateFactorSlider.
private static IntegerSliderEntry buildSpawnRateFactorSlider(Identifier blockId, LeafSettingsEntry entry) {
// Percentage values
int min = 0;
int max = 1000;
int stepSize = 10;
int currentValue = (int) (entry.spawnRateFactor * 100.0);
int defaultValue = (int) (ConfigDefaults.spawnRateFactor(blockId) * 100.0);
min /= stepSize;
max /= stepSize;
currentValue /= stepSize;
defaultValue /= stepSize;
return new IntSliderBuilder(RESET_TEXT, Text.translatable("config.fallingleaves.spawn_rate_factor"), currentValue, min, max).setDefaultValue(defaultValue).setSaveConsumer((Integer value) -> {
entry.spawnRateFactor = (value * stepSize) / 100.0;
}).setTextGetter((Integer value) -> {
return Text.of((value * stepSize) + "%");
}).setTooltip(Text.translatable("config.fallingleaves.spawn_rate_factor.@Tooltip")).build();
}
Aggregations