package com.mojang.realmsclient.util.task;

import org.apache.logging.log4j.LogManager;
import net.minecraft.network.chat.Component;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import com.mojang.realmsclient.gui.screens.RealmsLongRunningMcoTaskScreen;
import org.apache.logging.log4j.Logger;
import com.mojang.realmsclient.gui.ErrorCallback;

public abstract class LongRunningTask implements ErrorCallback, Runnable {
    public static final Logger LOGGER;
    protected RealmsLongRunningMcoTaskScreen longRunningMcoTaskScreen;
    
    protected static void pause(final int integer) {
        try {
            Thread.sleep(integer * 1000);
        }
        catch (InterruptedException interruptedException2) {
            LongRunningTask.LOGGER.error("", (Throwable)interruptedException2);
        }
    }
    
    public static void setScreen(final Screen dqs) {
        final Minecraft dlx2 = Minecraft.getInstance();
        dlx2.execute(() -> dlx2.setScreen(dqs));
    }
    
    public void setScreen(final RealmsLongRunningMcoTaskScreen djy) {
        this.longRunningMcoTaskScreen = djy;
    }
    
    @Override
    public void error(final Component mr) {
        this.longRunningMcoTaskScreen.error(mr);
    }
    
    public void setTitle(final String string) {
        this.longRunningMcoTaskScreen.setTitle(string);
    }
    
    public boolean aborted() {
        return this.longRunningMcoTaskScreen.aborted();
    }
    
    public void tick() {
    }
    
    public void init() {
    }
    
    public void abortTask() {
    }
    
    static {
        LOGGER = LogManager.getLogger();
    }
}
