Search in sources :

Example 6 with OptionSet

use of net.coderbot.iris.shaderpack.option.OptionSet in project Iris by IrisShaders.

the class Iris method queueDefaultShaderPackOptionValues.

// Used in favor of resetShaderPackOptions as the aforementioned requires the pack to be reloaded
public static void queueDefaultShaderPackOptionValues() {
    clearShaderPackOptionQueue();
    getCurrentPack().ifPresent(pack -> {
        OptionSet options = pack.getShaderPackOptions().getOptionSet();
        OptionValues values = pack.getShaderPackOptions().getOptionValues();
        options.getStringOptions().forEach((key, mOpt) -> {
            if (values.getStringValue(key).isPresent()) {
                getShaderPackOptionQueue().put(key, mOpt.getOption().getDefaultValue());
            }
        });
        options.getBooleanOptions().forEach((key, mOpt) -> {
            if (values.getBooleanValue(key) != OptionalBoolean.DEFAULT) {
                getShaderPackOptionQueue().put(key, Boolean.toString(mOpt.getOption().getDefaultValue()));
            }
        });
    });
}
Also used : MutableOptionValues(net.coderbot.iris.shaderpack.option.values.MutableOptionValues) OptionValues(net.coderbot.iris.shaderpack.option.values.OptionValues) OptionSet(net.coderbot.iris.shaderpack.option.OptionSet)

Aggregations

OptionSet (net.coderbot.iris.shaderpack.option.OptionSet)6 OptionAnnotatedSource (net.coderbot.iris.shaderpack.option.OptionAnnotatedSource)4 OptionValues (net.coderbot.iris.shaderpack.option.values.OptionValues)4 MutableOptionValues (net.coderbot.iris.shaderpack.option.values.MutableOptionValues)3 ProgramSource (net.coderbot.iris.shaderpack.ProgramSource)1 ShaderPack (net.coderbot.iris.shaderpack.ShaderPack)1 ProfileSet (net.coderbot.iris.shaderpack.option.ProfileSet)1 StringOption (net.coderbot.iris.shaderpack.option.StringOption)1 TextComponent (net.minecraft.network.chat.TextComponent)1