package net.minecraft.client.gui.screens;

import net.minecraft.network.chat.FormattedText;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.client.gui.chat.NarratorChatListener;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.client.Options;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.Option;

public class AccessibilityOptionsScreen extends OptionsSubScreen {
    private static final Option[] OPTIONS;
    private AbstractWidget narratorButton;
    
    public AccessibilityOptionsScreen(final Screen dqs, final Options dmb) {
        super(dqs, dmb, new TranslatableComponent("options.accessibility.title"));
    }
    
    @Override
    protected void init() {
        int integer2 = 0;
        for (final Option dma6 : AccessibilityOptionsScreen.OPTIONS) {
            final int integer3 = this.width / 2 - 155 + integer2 % 2 * 160;
            final int integer4 = this.height / 6 + 24 * (integer2 >> 1);
            final AbstractWidget dng9 = this.<AbstractWidget>addButton(dma6.createButton(this.minecraft.options, integer3, integer4, 150));
            if (dma6 == Option.NARRATOR) {
                this.narratorButton = dng9;
                dng9.active = NarratorChatListener.INSTANCE.isActive();
            }
            ++integer2;
        }
        this.<Button>addButton(new Button(this.width / 2 - 100, this.height / 6 + 144, 200, 20, CommonComponents.GUI_DONE, dni -> this.minecraft.setScreen(this.lastScreen)));
    }
    
    @Override
    public void render(final PoseStack dhl, final int integer2, final int integer3, final float float4) {
        this.renderBackground(dhl);
        this.drawCenteredString(dhl, this.font, this.title, this.width / 2, 20, 16777215);
        super.render(dhl, integer2, integer3, float4);
    }
    
    public void updateNarratorButton() {
        this.narratorButton.setMessage(Option.NARRATOR.getMessage(this.options));
    }
    
    static {
        OPTIONS = new Option[] { Option.NARRATOR, Option.SHOW_SUBTITLES, Option.TEXT_BACKGROUND_OPACITY, Option.TEXT_BACKGROUND, Option.CHAT_OPACITY, Option.CHAT_LINE_SPACING, Option.CHAT_DELAY, Option.AUTO_JUMP, Option.TOGGLE_CROUCH, Option.TOGGLE_SPRINT };
    }
}
