RealmsBridge .java

net.minecraft.realms.RealmsBridge (class, 56 lines): members: getNotificationScreen, previousScreen, switchToRealms, init, LOGGER. imports: GuiScreen.

net.minecraft.realmsclass56 linescommonextends RealmsScreen2.0 KB

API Surface (3)

void switchToRealms(GuiScreen p_switchToRealms_1_)
GuiScreenRealmsProxy getNotificationScreen(GuiScreen p_getNotificationScreen_1_)
void init()

Fields & Constants (2)

LOGGER
previousScreen

String literals (2)

"com.mojang.realmsclient.RealmsMainScreen"
"Realms module missing"

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

RealmsBridge.java56 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.realms;
2
3
import java.lang.reflect.Constructor;
4
import net.minecraft.client.Minecraft;
5
import net.minecraft.client.gui.GuiScreen;
6
import net.minecraft.client.gui.GuiScreenRealmsProxy;
7
import org.apache.logging.log4j.LogManager;
8
import org.apache.logging.log4j.Logger;
9
10
public class RealmsBridge extends RealmsScreen
11
{
12
    private static final Logger LOGGER = LogManager.getLogger();
13
    private GuiScreen previousScreen;
14
15
    public void switchToRealms(GuiScreen p_switchToRealms_1_)
16
    {
17
        this.previousScreen = p_switchToRealms_1_;
18
19
        try
20
        {
21
            Class<?> oclass = Class.forName("com.mojang.realmsclient.RealmsMainScreen");
22
            Constructor<?> constructor = oclass.getDeclaredConstructor(new Class[] {RealmsScreen.class});
23
            constructor.setAccessible(true);
24
            Object object = constructor.newInstance(new Object[] {this});
25
            Minecraft.getMinecraft().displayGuiScreen(((RealmsScreen)object).getProxy());
26
        }
27
        catch (Exception exception)
28
        {
29
            LOGGER.error((String)"Realms module missing", (Throwable)exception);
30
        }
31
    }
32
33
    public GuiScreenRealmsProxy getNotificationScreen(GuiScreen p_getNotificationScreen_1_)
34
    {
35
        try
36
        {
37
            this.previousScreen = p_getNotificationScreen_1_;
38
            Class<?> oclass = Class.forName("com.mojang.realmsclient.gui.screens.RealmsNotificationsScreen");
39
            Constructor<?> constructor = oclass.getDeclaredConstructor(new Class[] {RealmsScreen.class});
40
            constructor.setAccessible(true);
41
            Object object = constructor.newInstance(new Object[] {this});
42
            return ((RealmsScreen)object).getProxy();
43
        }
44
        catch (Exception exception)
45
        {
46
            LOGGER.error((String)"Realms module missing", (Throwable)exception);
47
            return null;
48
        }
49
    }
50
51
    public void init()
52
    {
53
        Minecraft.getMinecraft().displayGuiScreen(this.previousScreen);
54
    }
55
}
56

Deobfuscated MCP 1.8.9 source of RealmsBridge from Marcelektro/MavenMCP-1.8.9 (net/minecraft/realms/RealmsBridge.java), stored verbatim.