use of net.minecraft.client.gui.GuiScreenWorking in project UtilityClient2 by Utility-Client.
the class ResourcePackRepository method downloadResourcePack.
public ListenableFuture<Object> downloadResourcePack(String url, String hash) {
String s;
if (hash.matches("^[a-f0-9]{40}$")) {
s = hash;
} else {
s = "legacy";
}
final File file1 = new File(this.dirServerResourcepacks, s);
this.lock.lock();
try {
this.func_148529_f();
if (file1.exists() && hash.length() == 40) {
try {
String s1 = Hashing.sha1().hashBytes(Files.toByteArray(file1)).toString();
if (s1.equals(hash)) {
ListenableFuture listenablefuture1 = this.setResourcePackInstance(file1);
return listenablefuture1;
}
logger.warn("File " + file1 + " had wrong hash (expected " + hash + ", found " + s1 + "). Deleting it.");
FileUtils.deleteQuietly(file1);
} catch (IOException ioexception) {
logger.warn((String) ("File " + file1 + " couldn\'t be hashed. Deleting it."), (Throwable) ioexception);
FileUtils.deleteQuietly(file1);
}
}
this.func_183028_i();
final GuiScreenWorking guiscreenworking = new GuiScreenWorking();
Map<String, String> map = Minecraft.getSessionInfo();
final Minecraft minecraft = Minecraft.getMinecraft();
Futures.getUnchecked(minecraft.addScheduledTask(new Runnable() {
public void run() {
minecraft.displayGuiScreen(guiscreenworking);
}
}));
final SettableFuture<Object> settablefuture = SettableFuture.<Object>create();
this.field_177322_i = HttpUtil.downloadResourcePack(file1, url, map, 52428800, guiscreenworking, minecraft.getProxy());
Futures.addCallback(this.field_177322_i, new FutureCallback<Object>() {
public void onSuccess(Object p_onSuccess_1_) {
ResourcePackRepository.this.setResourcePackInstance(file1);
settablefuture.set((Object) null);
}
public void onFailure(Throwable p_onFailure_1_) {
settablefuture.setException(p_onFailure_1_);
}
});
ListenableFuture listenablefuture = this.field_177322_i;
return listenablefuture;
} finally {
this.lock.unlock();
}
}
use of net.minecraft.client.gui.GuiScreenWorking in project clientcommands by Earthcomputer.
the class ServerConnectorCVW method connect.
@Override
public void connect() {
Minecraft mc = Minecraft.getMinecraft();
mc.loadWorld(null);
System.gc();
YggdrasilAuthenticationService authService = new YggdrasilAuthenticationService(mc.getProxy(), UUID.randomUUID().toString());
MinecraftSessionService sessionService = authService.createMinecraftSessionService();
GameProfileRepository profileRepo = authService.createProfileRepository();
PlayerProfileCache profileCache = new PlayerProfileCache(profileRepo, new File(mc.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName()));
TileEntitySkull.setProfileCache(profileCache);
TileEntitySkull.setSessionService(sessionService);
PlayerProfileCache.setOnlineMode(false);
mc.integratedServer = new ClientVirtualServer(mc, dimensionId, gameType, previousServer, chunks, playerTag, authService, sessionService, profileRepo, profileCache);
mc.getIntegratedServer().startServerThread();
mc.integratedServerIsRunning = true;
mc.loadingScreen.displaySavingString(I18n.format("menu.loadingLevel"));
while (!mc.getIntegratedServer().serverIsInRunLoop()) {
if (!StartupQuery.check()) {
mc.loadWorld(null);
mc.displayGuiScreen(null);
return;
}
String message = mc.getIntegratedServer().getUserMessage();
if (message != null) {
mc.loadingScreen.displayLoadingString(I18n.format(message));
} else {
mc.loadingScreen.displayLoadingString("");
}
try {
Thread.sleep(200);
} catch (InterruptedException e) {
// ignore
}
}
mc.displayGuiScreen(new GuiScreenWorking());
SocketAddress socketAddress = mc.getIntegratedServer().getNetworkSystem().addLocalEndpoint();
NetworkManager netManager = NetworkManager.provideLocalClient(socketAddress);
netManager.setNetHandler(new NetHandlerLoginClient(netManager, mc, null));
netManager.sendPacket(new C00Handshake(socketAddress.toString(), 0, EnumConnectionState.LOGIN, true));
GameProfile gameProfile = mc.getSession().getProfile();
if (!mc.getSession().hasCachedProperties()) {
gameProfile = mc.getSessionService().fillProfileProperties(gameProfile, true);
mc.getSession().setProperties(gameProfile.getProperties());
}
netManager.sendPacket(new CPacketLoginStart(gameProfile));
mc.myNetworkManager = netManager;
}
Aggregations