package net.minecraft.client.gui.screens.multiplayer;

import java.util.Iterator;
import net.minecraft.client.gui.components.Button;
import java.util.Collection;
import com.google.common.collect.Lists;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.client.gui.chat.NarratorChatListener;
import java.util.List;
import net.minecraft.client.gui.components.Checkbox;
import net.minecraft.network.chat.Component;
import net.minecraft.client.gui.screens.Screen;

public class SafetyScreen extends Screen {
    private final Screen previous;
    private final Component title;
    private final Component content;
    private final Component check;
    private final Component proceed;
    private final Component back;
    private Checkbox stopShowing;
    private final List<String> lines;
    
    public SafetyScreen(final Screen dgb) {
        super(NarratorChatListener.NO_TITLE);
        this.title = new TranslatableComponent("multiplayerWarning.header", new Object[0]).withStyle(ChatFormatting.BOLD);
        this.content = new TranslatableComponent("multiplayerWarning.message", new Object[0]);
        this.check = new TranslatableComponent("multiplayerWarning.check", new Object[0]);
        this.proceed = new TranslatableComponent("gui.proceed", new Object[0]);
        this.back = new TranslatableComponent("gui.back", new Object[0]);
        this.lines = Lists.newArrayList();
        this.previous = dgb;
    }
    
    @Override
    protected void init() {
        super.init();
        this.lines.clear();
        this.lines.addAll(this.font.split(this.content.getColoredString(), this.width - 50));
        final int n = this.lines.size() + 1;
        this.font.getClass();
        final int integer2 = n * 9;
        this.<Button>addButton(new Button(this.width / 2 - 155, 100 + integer2, 150, 20, this.proceed.getColoredString(), dcv -> {
            if (this.stopShowing.selected()) {
                this.minecraft.options.skipMultiplayerWarning = true;
                this.minecraft.options.save();
            }
            this.minecraft.setScreen(new JoinMultiplayerScreen(this.previous));
            return;
        }));
        this.<Button>addButton(new Button(this.width / 2 - 155 + 160, 100 + integer2, 150, 20, this.back.getColoredString(), dcv -> this.minecraft.setScreen(this.previous)));
        this.<Checkbox>addButton(this.stopShowing = new Checkbox(this.width / 2 - 155 + 80, 76 + integer2, 150, 20, this.check.getColoredString(), false));
    }
    
    @Override
    public String getNarrationMessage() {
        return this.title.getString() + "\n" + this.content.getString();
    }
    
    @Override
    public void render(final int integer1, final int integer2, final float float3) {
        this.renderDirtBackground(0);
        this.drawCenteredString(this.font, this.title.getColoredString(), this.width / 2, 30, 16777215);
        int integer3 = 70;
        for (final String string7 : this.lines) {
            this.drawCenteredString(this.font, string7, this.width / 2, integer3, 16777215);
            final int n = integer3;
            this.font.getClass();
            integer3 = n + 9;
        }
        super.render(integer1, integer2, float3);
    }
}
