本文整理汇总了Java中net.minecraft.client.Minecraft.getSessionInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Minecraft.getSessionInfo方法的具体用法?Java Minecraft.getSessionInfo怎么用?Java Minecraft.getSessionInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.Minecraft
的用法示例。
在下文中一共展示了Minecraft.getSessionInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: downloadResourcePack
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
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();
}
}