package net.minecraft.client.gui.screens;

import java.util.Iterator;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.components.Button;
import java.util.Collection;
import com.google.common.collect.Lists;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.chat.FormattedText;
import java.util.List;

public class DatapackLoadFailureScreen extends Screen {
    private final List<FormattedText> lines;
    private final Runnable callback;
    
    public DatapackLoadFailureScreen(final Runnable runnable) {
        super(new TranslatableComponent("datapackFailure.title"));
        this.lines = Lists.newArrayList();
        this.callback = runnable;
    }
    
    @Override
    protected void init() {
        super.init();
        this.lines.clear();
        this.lines.addAll(this.font.split(this.getTitle(), this.width - 50));
        this.<Button>addButton(new Button(this.width / 2 - 155, this.height / 6 + 96, 150, 20, new TranslatableComponent("datapackFailure.safeMode"), dni -> this.callback.run()));
        this.<Button>addButton(new Button(this.width / 2 - 155 + 160, this.height / 6 + 96, 150, 20, new TranslatableComponent("gui.toTitle"), dni -> this.minecraft.setScreen(null)));
    }
    
    @Override
    public void render(final PoseStack dhl, final int integer2, final int integer3, final float float4) {
        this.renderBackground(dhl);
        int integer4 = 70;
        for (final FormattedText mu8 : this.lines) {
            this.drawCenteredString(dhl, this.font, mu8, this.width / 2, integer4, 16777215);
            final int n = integer4;
            this.font.getClass();
            integer4 = n + 9;
        }
        super.render(dhl, integer2, integer3, float4);
    }
    
    @Override
    public boolean shouldCloseOnEsc() {
        return false;
    }
}
