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.network.chat.Component;

public class ErrorScreen extends Screen {
    private final Component message;
    
    public ErrorScreen(final Component mr1, final Component mr2) {
        super(mr1);
        this.message = mr2;
    }
    
    @Override
    protected void init() {
        super.init();
        this.<Button>addButton(new Button(this.width / 2 - 100, 140, 200, 20, CommonComponents.GUI_CANCEL, dni -> this.minecraft.setScreen(null)));
    }
    
    @Override
    public void render(final PoseStack dhl, final int integer2, final int integer3, final float float4) {
        this.fillGradient(dhl, 0, 0, this.width, this.height, -12574688, -11530224);
        this.drawCenteredString(dhl, this.font, this.title, this.width / 2, 90, 16777215);
        this.drawCenteredString(dhl, this.font, this.message, this.width / 2, 110, 16777215);
        super.render(dhl, integer2, integer3, float4);
    }
    
    @Override
    public boolean shouldCloseOnEsc() {
        return false;
    }
}
