/**
* Fetches a cape for the given player and stores it's ResourceLocation in
* the capes map
*
* @param uuid UUID of the player to load the cape for
*/
public static void loadCape(final UUID uuid) {
if (CapesAPI.hasPendingRequests(uuid)) {
return;
}
CapesAPI.setCape(uuid, null);
String url = String.format(CapesAPI.BASE_URL, uuid);
ResourceLocation resourceLocation = new ResourceLocation(
String.format("capesapi/capes/%s.png", new Date().getTime())
);
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
ThreadDownloadImageData threadDownloadImageData = new ThreadDownloadImageData(null, url, null, new IImageBuffer() {
@Override
public BufferedImage parseUserSkin(BufferedImage image) {
return image;
}
@Override
public void skinAvailable() {
CapesAPI.setCape(uuid, resourceLocation);
// useless reloading Image whenever a Player dies, joins, leaves and re-enters Render range
// CapesAPI.pendingRequests.remove(uuid);
}
});
textureManager.loadTexture(resourceLocation, threadDownloadImageData);
CapesAPI.pendingRequests.add(uuid);
}
CapesAPI.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:CapesAPI-ClientImplementation
作者:
评论列表
文章目录