| 1 | package net.minecraft.realms;
|
| 2 |
|
| 3 | import com.google.common.util.concurrent.ListenableFuture;
|
| 4 | import com.mojang.authlib.GameProfile;
|
| 5 | import com.mojang.util.UUIDTypeAdapter;
|
| 6 | import java.net.Proxy;
|
| 7 | import net.minecraft.client.Minecraft;
|
| 8 | import net.minecraft.client.gui.GuiMainMenu;
|
| 9 | import net.minecraft.client.settings.GameSettings;
|
| 10 | import net.minecraft.util.Session;
|
| 11 | import net.minecraft.world.WorldSettings;
|
| 12 |
|
| 13 | public class Realms
|
| 14 | {
|
| 15 | public static boolean isTouchScreen()
|
| 16 | {
|
| 17 | return Minecraft.getMinecraft().gameSettings.touchscreen;
|
| 18 | }
|
| 19 |
|
| 20 | public static Proxy getProxy()
|
| 21 | {
|
| 22 | return Minecraft.getMinecraft().getProxy();
|
| 23 | }
|
| 24 |
|
| 25 | public static String sessionId()
|
| 26 | {
|
| 27 | Session session = Minecraft.getMinecraft().getSession();
|
| 28 | return session == null ? null : session.getSessionID();
|
| 29 | }
|
| 30 |
|
| 31 | public static String userName()
|
| 32 | {
|
| 33 | Session session = Minecraft.getMinecraft().getSession();
|
| 34 | return session == null ? null : session.getUsername();
|
| 35 | }
|
| 36 |
|
| 37 | public static long currentTimeMillis()
|
| 38 | {
|
| 39 | return Minecraft.getSystemTime();
|
| 40 | }
|
| 41 |
|
| 42 | public static String getSessionId()
|
| 43 | {
|
| 44 | return Minecraft.getMinecraft().getSession().getSessionID();
|
| 45 | }
|
| 46 |
|
| 47 | public static String getUUID()
|
| 48 | {
|
| 49 | return Minecraft.getMinecraft().getSession().getPlayerID();
|
| 50 | }
|
| 51 |
|
| 52 | public static String getName()
|
| 53 | {
|
| 54 | return Minecraft.getMinecraft().getSession().getUsername();
|
| 55 | }
|
| 56 |
|
| 57 | public static String uuidToName(String p_uuidToName_0_)
|
| 58 | {
|
| 59 | return Minecraft.getMinecraft().getSessionService().fillProfileProperties(new GameProfile(UUIDTypeAdapter.fromString(p_uuidToName_0_), (String)null), false).getName();
|
| 60 | }
|
| 61 |
|
| 62 | public static void setScreen(RealmsScreen p_setScreen_0_)
|
| 63 | {
|
| 64 | Minecraft.getMinecraft().displayGuiScreen(p_setScreen_0_.getProxy());
|
| 65 | }
|
| 66 |
|
| 67 | public static String getGameDirectoryPath()
|
| 68 | {
|
| 69 | return Minecraft.getMinecraft().mcDataDir.getAbsolutePath();
|
| 70 | }
|
| 71 |
|
| 72 | public static int survivalId()
|
| 73 | {
|
| 74 | return WorldSettings.GameType.SURVIVAL.getID();
|
| 75 | }
|
| 76 |
|
| 77 | public static int creativeId()
|
| 78 | {
|
| 79 | return WorldSettings.GameType.CREATIVE.getID();
|
| 80 | }
|
| 81 |
|
| 82 | public static int adventureId()
|
| 83 | {
|
| 84 | return WorldSettings.GameType.ADVENTURE.getID();
|
| 85 | }
|
| 86 |
|
| 87 | public static int spectatorId()
|
| 88 | {
|
| 89 | return WorldSettings.GameType.SPECTATOR.getID();
|
| 90 | }
|
| 91 |
|
| 92 | public static void setConnectedToRealms(boolean p_setConnectedToRealms_0_)
|
| 93 | {
|
| 94 | Minecraft.getMinecraft().setConnectedToRealms(p_setConnectedToRealms_0_);
|
| 95 | }
|
| 96 |
|
| 97 | public static ListenableFuture<Object> downloadResourcePack(String p_downloadResourcePack_0_, String p_downloadResourcePack_1_)
|
| 98 | {
|
| 99 | ListenableFuture<Object> listenablefuture = Minecraft.getMinecraft().getResourcePackRepository().downloadResourcePack(p_downloadResourcePack_0_, p_downloadResourcePack_1_);
|
| 100 | return listenablefuture;
|
| 101 | }
|
| 102 |
|
| 103 | public static void clearResourcePack()
|
| 104 | {
|
| 105 | Minecraft.getMinecraft().getResourcePackRepository().clearResourcePack();
|
| 106 | }
|
| 107 |
|
| 108 | public static boolean getRealmsNotificationsEnabled()
|
| 109 | {
|
| 110 | return Minecraft.getMinecraft().gameSettings.getOptionOrdinalValue(GameSettings.Options.REALMS_NOTIFICATIONS);
|
| 111 | }
|
| 112 |
|
| 113 | public static boolean inTitleScreen()
|
| 114 | {
|
| 115 | return Minecraft.getMinecraft().currentScreen != null && Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu;
|
| 116 | }
|
| 117 | }
|
| 118 |
|