package net.minecraft.client;

import net.minecraft.util.Mth;
import net.minecraft.client.gui.components.ChatComponent;
import com.mojang.blaze3d.platform.Window;
import net.minecraft.world.entity.player.ChatVisiblity;
import net.minecraft.client.gui.chat.NarratorChatListener;
import java.util.concurrent.Executor;
import net.minecraft.Util;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.gui.components.AbstractWidget;

public abstract class Option {
    public static final ProgressOption BIOME_BLEND_RADIUS;
    public static final ProgressOption CHAT_HEIGHT_FOCUSED;
    public static final ProgressOption CHAT_HEIGHT_UNFOCUSED;
    public static final ProgressOption CHAT_OPACITY;
    public static final ProgressOption CHAT_SCALE;
    public static final ProgressOption CHAT_WIDTH;
    public static final ProgressOption FOV;
    public static final ProgressOption FRAMERATE_LIMIT;
    public static final ProgressOption GAMMA;
    public static final ProgressOption MIPMAP_LEVELS;
    public static final ProgressOption MOUSE_WHEEL_SENSITIVITY;
    public static final BooleanOption RAW_MOUSE_INPUT;
    public static final ProgressOption RENDER_DISTANCE;
    public static final ProgressOption SENSITIVITY;
    public static final ProgressOption TEXT_BACKGROUND_OPACITY;
    public static final CycleOption AMBIENT_OCCLUSION;
    public static final CycleOption ATTACK_INDICATOR;
    public static final CycleOption CHAT_VISIBILITY;
    public static final CycleOption GRAPHICS;
    public static final CycleOption GUI_SCALE;
    public static final CycleOption MAIN_HAND;
    public static final CycleOption NARRATOR;
    public static final CycleOption PARTICLES;
    public static final CycleOption RENDER_CLOUDS;
    public static final CycleOption TEXT_BACKGROUND;
    public static final BooleanOption AUTO_JUMP;
    public static final BooleanOption AUTO_SUGGESTIONS;
    public static final BooleanOption CHAT_COLOR;
    public static final BooleanOption CHAT_LINKS;
    public static final BooleanOption CHAT_LINKS_PROMPT;
    public static final BooleanOption DISCRETE_MOUSE_SCROLL;
    public static final BooleanOption ENABLE_VSYNC;
    public static final BooleanOption ENTITY_SHADOWS;
    public static final BooleanOption FORCE_UNICODE_FONT;
    public static final BooleanOption INVERT_MOUSE;
    public static final BooleanOption REALMS_NOTIFICATIONS;
    public static final BooleanOption REDUCED_DEBUG_INFO;
    public static final BooleanOption SHOW_SUBTITLES;
    public static final BooleanOption SNOOPER_ENABLED;
    public static final CycleOption TOGGLE_CROUCH;
    public static final CycleOption TOGGLE_SPRINT;
    public static final BooleanOption TOUCHSCREEN;
    public static final BooleanOption USE_FULLSCREEN;
    public static final BooleanOption VIEW_BOBBING;
    private final String captionId;
    
    public Option(final String string) {
        this.captionId = string;
    }
    
    public abstract AbstractWidget createButton(final Options dbr, final int integer2, final int integer3, final int integer4);
    
    public String getCaption() {
        return I18n.get(this.captionId) + ": ";
    }
    
    static {
        final double double3;
        final String string5;
        final int integer2;
        BIOME_BLEND_RADIUS = new ProgressOption("options.biomeBlendRadius", 0.0, 7.0, 1.0f, dbr -> Double.valueOf(dbr.biomeBlendRadius), (dbr, double2) -> {
            dbr.biomeBlendRadius = Mth.clamp((int)(double)double2, 0, 7);
            Minecraft.getInstance().levelRenderer.allChanged();
            return;
        }, (dbr, dbt) -> {
            double3 = dbt.get(dbr);
            string5 = dbt.getCaption();
            integer2 = (int)double3 * 2 + 1;
            return string5 + I18n.get("options.biomeBlendRadius." + integer2);
        });
        final double double4;
        CHAT_HEIGHT_FOCUSED = new ProgressOption("options.chat.height.focused", 0.0, 1.0, 0.0f, dbr -> dbr.chatHeightFocused, (dbr, double2) -> {
            dbr.chatHeightFocused = double2;
            Minecraft.getInstance().gui.getChat().rescaleChat();
            return;
        }, (dbr, dbt) -> {
            double4 = dbt.toPct(dbt.get(dbr));
            return dbt.getCaption() + ChatComponent.getHeight(double4) + "px";
        });
        final double double5;
        CHAT_HEIGHT_UNFOCUSED = new ProgressOption("options.chat.height.unfocused", 0.0, 1.0, 0.0f, dbr -> dbr.chatHeightUnfocused, (dbr, double2) -> {
            dbr.chatHeightUnfocused = double2;
            Minecraft.getInstance().gui.getChat().rescaleChat();
            return;
        }, (dbr, dbt) -> {
            double5 = dbt.toPct(dbt.get(dbr));
            return dbt.getCaption() + ChatComponent.getHeight(double5) + "px";
        });
        final double double6;
        CHAT_OPACITY = new ProgressOption("options.chat.opacity", 0.0, 1.0, 0.0f, dbr -> dbr.chatOpacity, (dbr, double2) -> {
            dbr.chatOpacity = double2;
            Minecraft.getInstance().gui.getChat().rescaleChat();
            return;
        }, (dbr, dbt) -> {
            double6 = dbt.toPct(dbt.get(dbr));
            return dbt.getCaption() + (int)(double6 * 90.0 + 10.0) + "%";
        });
        final double double7;
        final String string6;
        CHAT_SCALE = new ProgressOption("options.chat.scale", 0.0, 1.0, 0.0f, dbr -> dbr.chatScale, (dbr, double2) -> {
            dbr.chatScale = double2;
            Minecraft.getInstance().gui.getChat().rescaleChat();
            return;
        }, (dbr, dbt) -> {
            double7 = dbt.toPct(dbt.get(dbr));
            string6 = dbt.getCaption();
            if (double7 == 0.0) {
                return string6 + I18n.get("options.off");
            }
            else {
                return string6 + (int)(double7 * 100.0) + "%";
            }
        });
        final double double8;
        CHAT_WIDTH = new ProgressOption("options.chat.width", 0.0, 1.0, 0.0f, dbr -> dbr.chatWidth, (dbr, double2) -> {
            dbr.chatWidth = double2;
            Minecraft.getInstance().gui.getChat().rescaleChat();
            return;
        }, (dbr, dbt) -> {
            double8 = dbt.toPct(dbt.get(dbr));
            return dbt.getCaption() + ChatComponent.getWidth(double8) + "px";
        });
        final double double9;
        final String string7;
        FOV = new ProgressOption("options.fov", 30.0, 110.0, 1.0f, dbr -> dbr.fov, (dbr, double2) -> dbr.fov = double2, (dbr, dbt) -> {
            double9 = dbt.get(dbr);
            string7 = dbt.getCaption();
            if (double9 == 70.0) {
                return string7 + I18n.get("options.fov.min");
            }
            else if (double9 == dbt.getMaxValue()) {
                return string7 + I18n.get("options.fov.max");
            }
            else {
                return string7 + (int)double9;
            }
        });
        final double double10;
        final String string8;
        FRAMERATE_LIMIT = new ProgressOption("options.framerateLimit", 10.0, 260.0, 10.0f, dbr -> Double.valueOf(dbr.framerateLimit), (dbr, double2) -> {
            dbr.framerateLimit = (int)(double)double2;
            Minecraft.getInstance().getWindow().setFramerateLimit(dbr.framerateLimit);
            return;
        }, (dbr, dbt) -> {
            double10 = dbt.get(dbr);
            string8 = dbt.getCaption();
            if (double10 == dbt.getMaxValue()) {
                return string8 + I18n.get("options.framerateLimit.max");
            }
            else {
                return string8 + I18n.get("options.framerate", (int)double10);
            }
        });
        final double double11;
        final String string9;
        GAMMA = new ProgressOption("options.gamma", 0.0, 1.0, 0.0f, dbr -> dbr.gamma, (dbr, double2) -> dbr.gamma = double2, (dbr, dbt) -> {
            double11 = dbt.toPct(dbt.get(dbr));
            string9 = dbt.getCaption();
            if (double11 == 0.0) {
                return string9 + I18n.get("options.gamma.min");
            }
            else if (double11 == 1.0) {
                return string9 + I18n.get("options.gamma.max");
            }
            else {
                return string9 + "+" + (int)(double11 * 100.0) + "%";
            }
        });
        final double double12;
        final String string10;
        MIPMAP_LEVELS = new ProgressOption("options.mipmapLevels", 0.0, 4.0, 1.0f, dbr -> Double.valueOf(dbr.mipmapLevels), (dbr, double2) -> dbr.mipmapLevels = (int)(double)double2, (dbr, dbt) -> {
            double12 = dbt.get(dbr);
            string10 = dbt.getCaption();
            if (double12 == 0.0) {
                return string10 + I18n.get("options.off");
            }
            else {
                return string10 + (int)double12;
            }
        });
        final double double13;
        MOUSE_WHEEL_SENSITIVITY = new LogaritmicProgressOption("options.mouseWheelSensitivity", 0.01, 10.0, 0.01f, dbr -> dbr.mouseWheelSensitivity, (dbr, double2) -> dbr.mouseWheelSensitivity = double2, (dbr, dbt) -> {
            double13 = dbt.toPct(dbt.get(dbr));
            return dbt.getCaption() + String.format("%.2f", dbt.toValue(double13));
        });
        final Window cxx3;
        RAW_MOUSE_INPUT = new BooleanOption("options.rawMouseInput", dbr -> dbr.rawMouseInput, (dbr, boolean2) -> {
            dbr.rawMouseInput = boolean2;
            cxx3 = Minecraft.getInstance().getWindow();
            if (cxx3 != null) {
                cxx3.updateRawMouseInput(boolean2);
            }
            return;
        });
        final double double14;
        RENDER_DISTANCE = new ProgressOption("options.renderDistance", 2.0, 16.0, 1.0f, dbr -> Double.valueOf(dbr.renderDistance), (dbr, double2) -> {
            dbr.renderDistance = (int)(double)double2;
            Minecraft.getInstance().levelRenderer.needsUpdate();
            return;
        }, (dbr, dbt) -> {
            double14 = dbt.get(dbr);
            return dbt.getCaption() + I18n.get("options.chunks", (int)double14);
        });
        final double double15;
        final String string11;
        SENSITIVITY = new ProgressOption("options.sensitivity", 0.0, 1.0, 0.0f, dbr -> dbr.sensitivity, (dbr, double2) -> dbr.sensitivity = double2, (dbr, dbt) -> {
            double15 = dbt.toPct(dbt.get(dbr));
            string11 = dbt.getCaption();
            if (double15 == 0.0) {
                return string11 + I18n.get("options.sensitivity.min");
            }
            else if (double15 == 1.0) {
                return string11 + I18n.get("options.sensitivity.max");
            }
            else {
                return string11 + (int)(double15 * 200.0) + "%";
            }
        });
        TEXT_BACKGROUND_OPACITY = new ProgressOption("options.accessibility.text_background_opacity", 0.0, 1.0, 0.0f, dbr -> dbr.textBackgroundOpacity, (dbr, double2) -> {
            dbr.textBackgroundOpacity = double2;
            Minecraft.getInstance().gui.getChat().rescaleChat();
            return;
        }, (dbr, dbt) -> dbt.getCaption() + (int)(dbt.toPct(dbt.get(dbr)) * 100.0) + "%");
        AMBIENT_OCCLUSION = new CycleOption("options.ao", (dbr, integer) -> {
            dbr.ambientOcclusion = AmbientOcclusionStatus.byId(dbr.ambientOcclusion.getId() + integer);
            Minecraft.getInstance().levelRenderer.allChanged();
            return;
        }, (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.ambientOcclusion.getKey()));
        ATTACK_INDICATOR = new CycleOption("options.attackIndicator", (dbr, integer) -> dbr.attackIndicator = AttackIndicatorStatus.byId(dbr.attackIndicator.getId() + integer), (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.attackIndicator.getKey()));
        CHAT_VISIBILITY = new CycleOption("options.chat.visibility", (dbr, integer) -> dbr.chatVisibility = ChatVisiblity.byId((dbr.chatVisibility.getId() + integer) % 3), (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.chatVisibility.getKey()));
        GRAPHICS = new CycleOption("options.graphics", (dbr, integer) -> {
            dbr.fancyGraphics = !dbr.fancyGraphics;
            Minecraft.getInstance().levelRenderer.allChanged();
            return;
        }, (dbr, dbe) -> {
            if (dbr.fancyGraphics) {
                return dbe.getCaption() + I18n.get("options.graphics.fancy");
            }
            else {
                return dbe.getCaption() + I18n.get("options.graphics.fast");
            }
        });
        GUI_SCALE = new CycleOption("options.guiScale", (dbr, integer) -> dbr.guiScale = Integer.remainderUnsigned(dbr.guiScale + integer, Minecraft.getInstance().getWindow().calculateScale(0, Minecraft.getInstance().isEnforceUnicode()) + 1), (dbr, dbe) -> dbe.getCaption() + ((dbr.guiScale == 0) ? I18n.get("options.guiScale.auto") : Integer.valueOf(dbr.guiScale)));
        MAIN_HAND = new CycleOption("options.mainHand", (dbr, integer) -> dbr.mainHand = dbr.mainHand.getOpposite(), (dbr, dbe) -> dbe.getCaption() + dbr.mainHand);
        NARRATOR = new CycleOption("options.narrator", (dbr, integer) -> {
            if (NarratorChatListener.INSTANCE.isActive()) {
                dbr.narratorStatus = NarratorStatus.byId(dbr.narratorStatus.getId() + integer);
            }
            else {
                dbr.narratorStatus = NarratorStatus.OFF;
            }
            NarratorChatListener.INSTANCE.updateNarratorStatus(dbr.narratorStatus);
            return;
        }, (dbr, dbe) -> {
            if (NarratorChatListener.INSTANCE.isActive()) {
                return dbe.getCaption() + I18n.get(dbr.narratorStatus.getKey());
            }
            else {
                return dbe.getCaption() + I18n.get("options.narrator.notavailable");
            }
        });
        PARTICLES = new CycleOption("options.particles", (dbr, integer) -> dbr.particles = ParticleStatus.byId(dbr.particles.getId() + integer), (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.particles.getKey()));
        RENDER_CLOUDS = new CycleOption("options.renderClouds", (dbr, integer) -> dbr.renderClouds = CloudStatus.byId(dbr.renderClouds.getId() + integer), (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.renderClouds.getKey()));
        TEXT_BACKGROUND = new CycleOption("options.accessibility.text_background", (dbr, integer) -> dbr.backgroundForChatOnly = !dbr.backgroundForChatOnly, (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.backgroundForChatOnly ? "options.accessibility.text_background.chat" : "options.accessibility.text_background.everywhere"));
        AUTO_JUMP = new BooleanOption("options.autoJump", dbr -> dbr.autoJump, (dbr, boolean2) -> dbr.autoJump = boolean2);
        AUTO_SUGGESTIONS = new BooleanOption("options.autoSuggestCommands", dbr -> dbr.autoSuggestions, (dbr, boolean2) -> dbr.autoSuggestions = boolean2);
        CHAT_COLOR = new BooleanOption("options.chat.color", dbr -> dbr.chatColors, (dbr, boolean2) -> dbr.chatColors = boolean2);
        CHAT_LINKS = new BooleanOption("options.chat.links", dbr -> dbr.chatLinks, (dbr, boolean2) -> dbr.chatLinks = boolean2);
        CHAT_LINKS_PROMPT = new BooleanOption("options.chat.links.prompt", dbr -> dbr.chatLinksPrompt, (dbr, boolean2) -> dbr.chatLinksPrompt = boolean2);
        DISCRETE_MOUSE_SCROLL = new BooleanOption("options.discrete_mouse_scroll", dbr -> dbr.discreteMouseScroll, (dbr, boolean2) -> dbr.discreteMouseScroll = boolean2);
        ENABLE_VSYNC = new BooleanOption("options.vsync", dbr -> dbr.enableVsync, (dbr, boolean2) -> {
            dbr.enableVsync = boolean2;
            if (Minecraft.getInstance().getWindow() != null) {
                Minecraft.getInstance().getWindow().updateVsync(dbr.enableVsync);
            }
            return;
        });
        ENTITY_SHADOWS = new BooleanOption("options.entityShadows", dbr -> dbr.entityShadows, (dbr, boolean2) -> dbr.entityShadows = boolean2);
        final Minecraft dbn3;
        FORCE_UNICODE_FONT = new BooleanOption("options.forceUnicodeFont", dbr -> dbr.forceUnicodeFont, (dbr, boolean2) -> {
            dbr.forceUnicodeFont = boolean2;
            dbn3 = Minecraft.getInstance();
            if (dbn3.getFontManager() != null) {
                dbn3.getFontManager().setForceUnicode(dbr.forceUnicodeFont, Util.backgroundExecutor(), dbn3);
            }
            return;
        });
        INVERT_MOUSE = new BooleanOption("options.invertMouse", dbr -> dbr.invertYMouse, (dbr, boolean2) -> dbr.invertYMouse = boolean2);
        REALMS_NOTIFICATIONS = new BooleanOption("options.realmsNotifications", dbr -> dbr.realmsNotifications, (dbr, boolean2) -> dbr.realmsNotifications = boolean2);
        REDUCED_DEBUG_INFO = new BooleanOption("options.reducedDebugInfo", dbr -> dbr.reducedDebugInfo, (dbr, boolean2) -> dbr.reducedDebugInfo = boolean2);
        SHOW_SUBTITLES = new BooleanOption("options.showSubtitles", dbr -> dbr.showSubtitles, (dbr, boolean2) -> dbr.showSubtitles = boolean2);
        SNOOPER_ENABLED = new BooleanOption("options.snooper", dbr -> {
            if (dbr.snooperEnabled) {}
            return false;
        }, (dbr, boolean2) -> dbr.snooperEnabled = boolean2);
        TOGGLE_CROUCH = new CycleOption("key.sneak", (dbr, integer) -> dbr.toggleCrouch = !dbr.toggleCrouch, (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.toggleCrouch ? "options.key.toggle" : "options.key.hold"));
        TOGGLE_SPRINT = new CycleOption("key.sprint", (dbr, integer) -> dbr.toggleSprint = !dbr.toggleSprint, (dbr, dbe) -> dbe.getCaption() + I18n.get(dbr.toggleSprint ? "options.key.toggle" : "options.key.hold"));
        TOUCHSCREEN = new BooleanOption("options.touchscreen", dbr -> dbr.touchscreen, (dbr, boolean2) -> dbr.touchscreen = boolean2);
        final Minecraft dbn4;
        USE_FULLSCREEN = new BooleanOption("options.fullscreen", dbr -> dbr.fullscreen, (dbr, boolean2) -> {
            dbr.fullscreen = boolean2;
            dbn4 = Minecraft.getInstance();
            if (dbn4.getWindow() != null && dbn4.getWindow().isFullscreen() != dbr.fullscreen) {
                dbn4.getWindow().toggleFullScreen();
                dbr.fullscreen = dbn4.getWindow().isFullscreen();
            }
            return;
        });
        VIEW_BOBBING = new BooleanOption("options.viewBobbing", dbr -> dbr.bobView, (dbr, boolean2) -> dbr.bobView = boolean2);
    }
}
