use of net.minecraft.client.renderer.ThreadDownloadImageData in project Armourers-Workshop by RiskyKen.
the class SkinHelper method getBufferedImageSkin.
public static BufferedImage getBufferedImageSkin(GameProfile gameProfile) {
BufferedImage bufferedImage = null;
ResourceLocation skinloc = AbstractClientPlayer.locationStevePng;
InputStream inputStream = null;
Minecraft mc = Minecraft.getMinecraft();
Map map = mc.func_152342_ad().func_152788_a(gameProfile);
try {
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
skinloc = mc.func_152342_ad().func_152792_a((MinecraftProfileTexture) map.get(Type.SKIN), Type.SKIN);
ITextureObject skintex = mc.getTextureManager().getTexture(skinloc);
if (skintex instanceof ThreadDownloadImageData) {
ThreadDownloadImageData imageData = (ThreadDownloadImageData) skintex;
bufferedImage = ObfuscationReflectionHelper.getPrivateValue(ThreadDownloadImageData.class, imageData, "bufferedImage", "field_110560_d", "bpr.h");
} else {
inputStream = Minecraft.getMinecraft().getResourceManager().getResource(skinloc).getInputStream();
bufferedImage = ImageIO.read(inputStream);
}
} else {
inputStream = Minecraft.getMinecraft().getResourceManager().getResource(skinloc).getInputStream();
bufferedImage = ImageIO.read(inputStream);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(inputStream);
}
return bufferedImage;
}
use of net.minecraft.client.renderer.ThreadDownloadImageData in project Armourers-Workshop by RiskyKen.
the class SkinHelper method getBuffFromResourceLocation.
private static BufferedImage getBuffFromResourceLocation(ResourceLocation rl) {
BufferedImage bi = null;
InputStream inputStream = null;
try {
ITextureObject skintex = Minecraft.getMinecraft().getTextureManager().getTexture(rl);
if (skintex instanceof ThreadDownloadImageData) {
ThreadDownloadImageData imageData = (ThreadDownloadImageData) skintex;
bi = ObfuscationReflectionHelper.getPrivateValue(ThreadDownloadImageData.class, imageData, "bufferedImage", "field_110560_d", "bpr.h");
} else {
inputStream = Minecraft.getMinecraft().getResourceManager().getResource(rl).getInputStream();
bi = ImageIO.read(inputStream);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(inputStream);
}
return bi;
}
use of net.minecraft.client.renderer.ThreadDownloadImageData in project Armourers-Workshop by RiskyKen.
the class SkinHelper method getBufferedImageSkin.
public static BufferedImage getBufferedImageSkin(ResourceLocation resourceLocation) {
Minecraft mc = Minecraft.getMinecraft();
BufferedImage bufferedImage = null;
InputStream inputStream = null;
try {
ITextureObject skintex = mc.getTextureManager().getTexture(resourceLocation);
if (skintex instanceof ThreadDownloadImageData) {
ThreadDownloadImageData imageData = (ThreadDownloadImageData) skintex;
bufferedImage = ObfuscationReflectionHelper.getPrivateValue(ThreadDownloadImageData.class, imageData, "bufferedImage", "field_110560_d", "bpr.h");
} else {
inputStream = Minecraft.getMinecraft().getResourceManager().getResource(resourceLocation).getInputStream();
bufferedImage = ImageIO.read(inputStream);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(inputStream);
}
return bufferedImage;
}
Aggregations