package com.mojang.realmsclient.gui.screens; import net.minecraft.network.chat.FormattedText; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.components.Button; import net.minecraft.realms.NarrationHelper; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.TextComponent; import com.mojang.realmsclient.exception.RealmsServiceException; import net.minecraft.network.chat.Component; import net.minecraft.client.gui.screens.Screen; import net.minecraft.realms.RealmsScreen; public class RealmsGenericErrorScreen extends RealmsScreen { private final Screen nextScreen; private Component line1; private Component line2; public RealmsGenericErrorScreen(final RealmsServiceException djh, final Screen dqs) { this.nextScreen = dqs; this.errorMessage(djh); } public RealmsGenericErrorScreen(final Component mr, final Screen dqs) { this.nextScreen = dqs; this.errorMessage(mr); } public RealmsGenericErrorScreen(final Component mr1, final Component mr2, final Screen dqs) { this.nextScreen = dqs; this.errorMessage(mr1, mr2); } private void errorMessage(final RealmsServiceException djh) { if (djh.errorCode == -1) { this.line1 = new TextComponent("An error occurred (" + djh.httpResultCode + "):"); this.line2 = new TextComponent(djh.httpResponseContent); } else { this.line1 = new TextComponent("Realms (" + djh.errorCode + "):"); final String string3 = "mco.errorMessage." + djh.errorCode; this.line2 = (I18n.exists(string3) ? new TranslatableComponent(string3) : Component.nullToEmpty(djh.errorMsg)); } } private void errorMessage(final Component mr) { this.line1 = new TextComponent("An error occurred: "); this.line2 = mr; } private void errorMessage(final Component mr1, final Component mr2) { this.line1 = mr1; this.line2 = mr2; } public void init() { NarrationHelper.now(this.line1.getString() + ": " + this.line2.getString()); this.