Search in sources :

Example 1 with AuthenticationService

use of com.mojang.authlib.AuthenticationService in project CumServerPro by MCUmbrella.

the class Minecraft method loadWorld.

public void loadWorld(@Nullable WorldClient worldClientIn, String loadingMessage) {
    if (world != null)
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(world));
    if (worldClientIn == null) {
        NetHandlerPlayClient nethandlerplayclient = this.getConnection();
        if (nethandlerplayclient != null) {
            nethandlerplayclient.cleanup();
        }
        if (this.integratedServer != null && this.integratedServer.isAnvilFileSet()) {
            this.integratedServer.initiateShutdown();
            if (loadingScreen != null && this.running) {
                this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal"));
            }
            while (!integratedServer.isServerStopped()) {
                try {
                    Thread.sleep(10);
                } catch (InterruptedException ie) {
                }
            }
        }
        this.integratedServer = null;
        this.entityRenderer.resetData();
        this.playerController = null;
        NarratorChatListener.INSTANCE.clear();
    }
    this.renderViewEntity = null;
    this.myNetworkManager = null;
    if (this.loadingScreen != null) {
        this.loadingScreen.resetProgressAndMessage(loadingMessage);
        this.loadingScreen.displayLoadingString("");
    }
    if (worldClientIn == null && this.world != null) {
        this.mcResourcePackRepository.clearResourcePack();
        this.ingameGUI.resetPlayersOverlayFooterHeader();
        this.setServerData((ServerData) null);
        this.integratedServerIsRunning = false;
        net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.world);
    }
    this.mcSoundHandler.stopSounds();
    this.world = worldClientIn;
    if (this.renderGlobal != null) {
        this.renderGlobal.setWorldAndLoadRenderers(worldClientIn);
    }
    if (this.effectRenderer != null) {
        this.effectRenderer.clearEffects(worldClientIn);
    }
    TileEntityRendererDispatcher.instance.setWorld(worldClientIn);
    net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
    if (worldClientIn != null) {
        if (!this.integratedServerIsRunning) {
            AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString());
            MinecraftSessionService minecraftsessionservice = authenticationservice.createMinecraftSessionService();
            GameProfileRepository gameprofilerepository = authenticationservice.createProfileRepository();
            PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(this.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName()));
            TileEntitySkull.setProfileCache(playerprofilecache);
            TileEntitySkull.setSessionService(minecraftsessionservice);
            PlayerProfileCache.setOnlineMode(false);
        }
        if (this.player == null) {
            this.player = this.playerController.createPlayer(worldClientIn, new StatisticsManager(), new RecipeBookClient());
            this.playerController.flipPlayer(this.player);
        }
        this.player.preparePlayerToSpawn();
        worldClientIn.spawnEntity(this.player);
        this.player.movementInput = new MovementInputFromOptions(this.gameSettings);
        this.playerController.setPlayerCapabilities(this.player);
        this.renderViewEntity = this.player;
    } else {
        this.saveLoader.flushCache();
        this.player = null;
    }
    System.gc();
    this.systemTime = 0L;
}
Also used : PlayerProfileCache(net.minecraft.server.management.PlayerProfileCache) GameProfileRepository(com.mojang.authlib.GameProfileRepository) MovementInputFromOptions(net.minecraft.util.MovementInputFromOptions) MinecraftSessionService(com.mojang.authlib.minecraft.MinecraftSessionService) RecipeBookClient(net.minecraft.client.util.RecipeBookClient) StatisticsManager(net.minecraft.stats.StatisticsManager) NetHandlerPlayClient(net.minecraft.client.network.NetHandlerPlayClient) YggdrasilAuthenticationService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService) YggdrasilAuthenticationService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService) AuthenticationService(com.mojang.authlib.AuthenticationService) File(java.io.File)

Example 2 with AuthenticationService

use of com.mojang.authlib.AuthenticationService in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class Minecraft method loadWorld.

/**
 * par2Str is displayed on the loading screen to the user unloads the current world first
 */
public void loadWorld(@Nullable WorldClient worldClientIn, String loadingMessage) {
    if (worldClientIn == null) {
        NetHandlerPlayClient nethandlerplayclient = this.getConnection();
        if (nethandlerplayclient != null) {
            nethandlerplayclient.cleanup();
        }
        if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) {
            this.theIntegratedServer.initiateShutdown();
        }
        this.theIntegratedServer = null;
        this.entityRenderer.func_190564_k();
        this.playerController = null;
        NarratorChatListener.field_193643_a.func_193642_b();
    }
    this.renderViewEntity = null;
    this.myNetworkManager = null;
    if (this.loadingScreen != null) {
        this.loadingScreen.resetProgressAndMessage(loadingMessage);
        this.loadingScreen.displayLoadingString("");
    }
    if (worldClientIn == null && this.world != null) {
        this.mcResourcePackRepository.clearResourcePack();
        this.ingameGUI.resetPlayersOverlayFooterHeader();
        this.setServerData((ServerData) null);
        this.integratedServerIsRunning = false;
    }
    this.mcSoundHandler.stopSounds();
    this.world = worldClientIn;
    if (this.renderGlobal != null) {
        this.renderGlobal.setWorldAndLoadRenderers(worldClientIn);
    }
    if (this.effectRenderer != null) {
        this.effectRenderer.clearEffects(worldClientIn);
    }
    TileEntityRendererDispatcher.instance.setWorld(worldClientIn);
    if (worldClientIn != null) {
        if (!this.integratedServerIsRunning) {
            AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString());
            MinecraftSessionService minecraftsessionservice = authenticationservice.createMinecraftSessionService();
            GameProfileRepository gameprofilerepository = authenticationservice.createProfileRepository();
            PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(this.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName()));
            TileEntitySkull.setProfileCache(playerprofilecache);
            TileEntitySkull.setSessionService(minecraftsessionservice);
            PlayerProfileCache.setOnlineMode(false);
        }
        if (this.player == null) {
            this.player = this.playerController.func_192830_a(worldClientIn, new StatisticsManager(), new RecipeBookClient());
            this.playerController.flipPlayer(this.player);
        }
        this.player.preparePlayerToSpawn();
        worldClientIn.spawnEntityInWorld(this.player);
        this.player.movementInput = new MovementInputFromOptions(this.gameSettings);
        this.playerController.setPlayerCapabilities(this.player);
        this.renderViewEntity = this.player;
    } else {
        this.saveLoader.flushCache();
        this.player = null;
    }
    System.gc();
    this.systemTime = 0L;
}
Also used : StatisticsManager(net.minecraft.stats.StatisticsManager) PlayerProfileCache(net.minecraft.server.management.PlayerProfileCache) NetHandlerPlayClient(net.minecraft.client.network.NetHandlerPlayClient) GameProfileRepository(com.mojang.authlib.GameProfileRepository) MovementInputFromOptions(net.minecraft.util.MovementInputFromOptions) YggdrasilAuthenticationService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService) MinecraftSessionService(com.mojang.authlib.minecraft.MinecraftSessionService) YggdrasilAuthenticationService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService) AuthenticationService(com.mojang.authlib.AuthenticationService) File(java.io.File) RecipeBookClient(net.minecraft.client.util.RecipeBookClient)

Example 3 with AuthenticationService

use of com.mojang.authlib.AuthenticationService in project pollen by MoonflowerTeam.

the class SkinHelper method init.

@ApiStatus.Internal
public static void init() {
    AuthenticationService authenticationservice = new YggdrasilAuthenticationService(Minecraft.getInstance().getProxy());
    sessionService = authenticationservice.createMinecraftSessionService();
    gameProfileCache = new GameProfileCache(authenticationservice.createProfileRepository(), new File(Minecraft.getInstance().gameDirectory, MinecraftServer.USERID_CACHE_FILE.getName()));
}
Also used : GameProfileCache(net.minecraft.server.players.GameProfileCache) YggdrasilAuthenticationService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService) YggdrasilAuthenticationService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService) AuthenticationService(com.mojang.authlib.AuthenticationService) File(java.io.File)

Aggregations

AuthenticationService (com.mojang.authlib.AuthenticationService)3 YggdrasilAuthenticationService (com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService)3 File (java.io.File)3 GameProfileRepository (com.mojang.authlib.GameProfileRepository)2 MinecraftSessionService (com.mojang.authlib.minecraft.MinecraftSessionService)2 NetHandlerPlayClient (net.minecraft.client.network.NetHandlerPlayClient)2 RecipeBookClient (net.minecraft.client.util.RecipeBookClient)2 PlayerProfileCache (net.minecraft.server.management.PlayerProfileCache)2 StatisticsManager (net.minecraft.stats.StatisticsManager)2 MovementInputFromOptions (net.minecraft.util.MovementInputFromOptions)2 GameProfileCache (net.minecraft.server.players.GameProfileCache)1