use of net.minecraft.client.renderer.ThreadDownloadImageData in project Bookshelf by Darkhax-Minecraft.
the class RenderUtils method downloadResource.
/**
* Attempts to download a resource from the web and load it into the game. If the resource
* can not be downloaded successfully.
*
* @param url The URL to download the resource from. This should be the raw/source url.
* @param outputResource The ResourceLocation to use for the newly downloaded resource.
* @param defaultResource The default texture to use, on the chance that it fails to
* download a texture. This must be a valid texture, or else you will get a missing
* texture.
* @param buffer A special buffer to use when downloading the image. It is okay to pass
* null for this if you don't want anything fancy.
* @return The downloaded image data.
*/
public static ThreadDownloadImageData downloadResource(String url, ResourceLocation outputResource, ResourceLocation defaultResource, IImageBuffer buffer) {
final TextureManager manager = Minecraft.getMinecraft().getTextureManager();
ThreadDownloadImageData imageData = (ThreadDownloadImageData) manager.getTexture(outputResource);
if (imageData == null) {
imageData = new ThreadDownloadImageData(null, url, defaultResource, buffer);
manager.loadTexture(outputResource, imageData);
}
return imageData;
}
use of net.minecraft.client.renderer.ThreadDownloadImageData in project Wurst-MC-1.12 by Wurst-Imperium.
the class AltRenderer method bindSkinTexture.
private static void bindSkinTexture(String name) {
ResourceLocation location = AbstractClientPlayer.getLocationSkin(name);
if (loadedSkins.contains(name)) {
mc.getTextureManager().bindTexture(location);
return;
}
try {
ThreadDownloadImageData img = AbstractClientPlayer.getDownloadImageSkin(location, name);
img.loadTexture(mc.getResourceManager());
} catch (IOException e) {
e.printStackTrace();
}
mc.getTextureManager().bindTexture(location);
loadedSkins.add(name);
}
use of net.minecraft.client.renderer.ThreadDownloadImageData in project ArsMagica2 by Mithion.
the class CloakUtils method renderCloakModel.
public static void renderCloakModel(EntityPlayer player, ModelBiped mainModel, float partialRenderTick) {
if (!AMCore.proxy.playerTracker.hasCLDM(player.getUniqueID().toString()))
return;
// cloaks obey the inverse of show cape
if (!player.getHideCape())
return;
int dm = AMCore.proxy.playerTracker.getCLDM(player.getUniqueID().toString());
ResourceLocation capeLoc = getCapeLocation(player.getUniqueID().toString());
ThreadDownloadImageData capeImg = downloadCapeTexture(capeLoc, player.getUniqueID().toString());
EntityPlayer localPlayer = Minecraft.getMinecraft().thePlayer;
GL11.glPushMatrix();
double dx = (player.prevPosX + (player.posX - player.prevPosX) * partialRenderTick) - (localPlayer.prevPosX + (localPlayer.posX - localPlayer.prevPosX) * partialRenderTick);
double dy = (player.prevPosY + (player.posY - player.prevPosY) * partialRenderTick) - (localPlayer.prevPosY + (localPlayer.posY - localPlayer.prevPosY) * partialRenderTick);
if (player != localPlayer)
dy += player.height - player.yOffset - 0.125f;
double dz = (player.prevPosZ + (player.posZ - player.prevPosZ) * partialRenderTick) - (localPlayer.prevPosZ + (localPlayer.posZ - localPlayer.prevPosZ) * partialRenderTick);
GL11.glTranslated(dx, dy, dz);
cloak.render(player, mainModel, 0.0625f, partialRenderTick, capeLoc, dm);
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.ThreadDownloadImageData in project ArsMagica2 by Mithion.
the class ShadowSkinHelper method getDownloadImage.
private static ThreadDownloadImageData getDownloadImage(ResourceLocation par0ResourceLocation, String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer) {
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
Object object = texturemanager.getTexture(par0ResourceLocation);
if (object == null) {
object = new ThreadDownloadImageData((File) null, par1Str, par2ResourceLocation, par3IImageBuffer);
texturemanager.loadTexture(par0ResourceLocation, (ITextureObject) object);
}
return (ThreadDownloadImageData) object;
}
use of net.minecraft.client.renderer.ThreadDownloadImageData in project Armourers-Workshop by RiskyKen.
the class SkinTexture method updateForResourceLocation.
public void updateForResourceLocation(ResourceLocation resourceLocation) {
if (lastProfileHash == resourceLocation.hashCode() & bufferedPlayerImage != null) {
return;
}
BufferedImage bi = null;
InputStream inputStream = null;
try {
ITextureObject skintex = mc.getTextureManager().getTexture(resourceLocation);
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(resourceLocation).getInputStream();
bi = ImageIO.read(inputStream);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(inputStream);
}
if (bi == null) {
return;
}
bufferedPlayerImage = SkinHelper.deepCopyBufferedImage(bi);
lastProfileHash = resourceLocation.hashCode();
needsUpdate = true;
}
Aggregations