Java 类net.minecraft.client.renderer.IImageBuffer 实例源码
项目:CapesAPI-ClientImplementation
文件:CapesAPI.java
/**
* 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);
}
项目:connor41-etfuturum2
文件:NewThreadDownloadImageData.java
public NewThreadDownloadImageData(File file, String imageUrl, ResourceLocation texture, NewImageBufferDownload imgDownload, ResourceLocation resLocationOld, IImageBuffer imageBuffer) {
super(texture);
field_152434_e = file;
this.imageUrl = imageUrl;
this.imgDownload = imgDownload;
this.resLocationOld = resLocationOld;
this.imageBuffer = imageBuffer;
}
项目:connor41-etfuturum2
文件:NewSkinManager.java
@Override
public ResourceLocation func_152789_a(final MinecraftProfileTexture texture, final Type type, final SkinManager.SkinAvailableCallback callBack) {
if (type != Type.SKIN)
return super.func_152789_a(texture, type, callBack);
final boolean isSpecialCallBack = callBack instanceof ISkinDownloadCallback;
final ResourceLocation resLocationOld = new ResourceLocation("skins/" + texture.getHash());
final ResourceLocation resLocation = new ResourceLocation(Reference.MOD_ID, resLocationOld.getResourcePath());
ITextureObject itextureobject = textureManager.getTexture(resLocation);
if (itextureobject != null) {
if (callBack != null)
callBack.func_152121_a(type, resLocation);
} else {
File file1 = new File(skinFolder, texture.getHash().substring(0, 2));
File file2 = new File(file1, texture.getHash());
final NewImageBufferDownload imgDownload = new NewImageBufferDownload();
ITextureObject imgData = new NewThreadDownloadImageData(file2, texture.getUrl(), field_152793_a, imgDownload, resLocationOld, new IImageBuffer() {
@Override
public BufferedImage parseUserSkin(BufferedImage buffImg) {
if (buffImg != null)
PlayerModelManager.analyseTexture(buffImg, resLocation);
return imgDownload.parseUserSkin(buffImg);
}
@Override
public void func_152634_a() {
imgDownload.func_152634_a();
if (callBack != null)
callBack.func_152121_a(type, isSpecialCallBack ? resLocation : resLocationOld);
}
});
textureManager.loadTexture(resLocation, imgData);
textureManager.loadTexture(resLocationOld, imgData); // Avoid thrown exception if the image is requested before the download is done
}
return isSpecialCallBack ? resLocation : resLocationOld;
}
项目:4Space-5
文件:ThreadDownloadImageDataGC.java
public ThreadDownloadImageDataGC(File p_i1049_1_, String p_i1049_2_, ResourceLocation p_i1049_3_, IImageBuffer p_i1049_4_)
{
super(p_i1049_3_);
this.field_152434_e = p_i1049_1_;
this.imageUrl = p_i1049_2_;
this.imageBuffer = p_i1049_4_;
}
项目:MineLittlePony
文件:ThreadDownloadImageETag.java
public ThreadDownloadImageETag(@Nonnull File cacheFileIn, String imageUrlIn, ResourceLocation defLocation, @Nullable IImageBuffer imageBufferIn) {
super(defLocation);
this.cacheFile = cacheFileIn;
this.eTagFile = new File(cacheFile.getParentFile(), cacheFile.getName() + ".etag");
this.imageUrl = imageUrlIn;
this.imageBuffer = imageBufferIn;
}
项目:MineLittlePony
文件:HDSkinManager.java
private void loadTexture(GameProfile profile, final Type type, final SkinAvailableCallback callback) {
if (profile.getId() != null) {
Map<Type, MinecraftProfileTexture> data = getProfileData(profile);
final MinecraftProfileTexture texture = data.get(type);
String skinDir = type.toString().toLowerCase() + "s/";
final ResourceLocation skin = new ResourceLocation("hdskins", skinDir + texture.getHash());
File file2 = new File(LiteLoader.getAssetsDirectory(), "hd/" + skinDir + texture.getHash().substring(0, 2) + "/" + texture.getHash());
final IImageBuffer imagebufferdownload = type == Type.SKIN ? new ImageBufferDownloadHD() : null;
ITextureObject texObject = new ThreadDownloadImageETag(file2, texture.getUrl(),
DefaultPlayerSkin.getDefaultSkinLegacy(),
new IImageBuffer() {
@Nonnull
@Override
public BufferedImage parseUserSkin(@Nonnull BufferedImage image) {
BufferedImage image1 = image;
if (imagebufferdownload != null) {
image1 = imagebufferdownload.parseUserSkin(image);
}
return image1 == null ? image : image1;
}
@Override
public void skinAvailable() {
if (imagebufferdownload != null) {
imagebufferdownload.skinAvailable();
}
callback.skinAvailable(type, skin, texture);
}
});
// schedule texture loading on the main thread.
TextureLoader.loadTexture(skin, texObject);
}
}
项目:MineLittlePony
文件:HDSkinManager.java
@Nullable
public static PreviewTexture getPreviewTexture(ResourceLocation skinResource, GameProfile profile, Type type, ResourceLocation def, @Nullable final SkinAvailableCallback callback) {
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
MinecraftProfileTexture url = INSTANCE.getGatewayServer().getPreviewTexture(type, profile).orElse(null);
if (url == null)
return null;
IImageBuffer buffer = new ImageBufferDownloadHD();
PreviewTexture skinTexture = new PreviewTexture(url.getUrl(), def, type == Type.SKIN ? new IImageBuffer() {
@Override
@Nullable
public BufferedImage parseUserSkin(BufferedImage image) {
return buffer.parseUserSkin(image);
}
@Override
public void skinAvailable() {
if (callback != null) {
callback.skinAvailable(type, skinResource, new MinecraftProfileTexture(url.getUrl(), Maps.newHashMap()));
}
}
} : null);
textureManager.loadTexture(skinResource, skinTexture);
return skinTexture;
}
项目:Et-Futurum
文件:NewThreadDownloadImageData.java
public NewThreadDownloadImageData(File file, String imageUrl, ResourceLocation texture, NewImageBufferDownload imgDownload, ResourceLocation resLocationOld, IImageBuffer imageBuffer) {
super(texture);
field_152434_e = file;
this.imageUrl = imageUrl;
this.imgDownload = imgDownload;
this.resLocationOld = resLocationOld;
this.imageBuffer = imageBuffer;
}
项目:Et-Futurum
文件:NewSkinManager.java
@Override
public ResourceLocation func_152789_a(final MinecraftProfileTexture texture, final Type type, final SkinManager.SkinAvailableCallback callBack) {
if (type != Type.SKIN)
return super.func_152789_a(texture, type, callBack);
final boolean isSpecialCallBack = callBack instanceof ISkinDownloadCallback;
final ResourceLocation resLocationOld = new ResourceLocation("skins/" + texture.getHash());
final ResourceLocation resLocation = new ResourceLocation(Reference.MOD_ID, resLocationOld.getResourcePath());
ITextureObject itextureobject = textureManager.getTexture(resLocation);
if (itextureobject != null) {
if (callBack != null)
callBack.func_152121_a(type, resLocation);
} else {
File file1 = new File(skinFolder, texture.getHash().substring(0, 2));
File file2 = new File(file1, texture.getHash());
final NewImageBufferDownload imgDownload = new NewImageBufferDownload();
ITextureObject imgData = new NewThreadDownloadImageData(file2, texture.getUrl(), field_152793_a, imgDownload, resLocationOld, new IImageBuffer() {
@Override
public BufferedImage parseUserSkin(BufferedImage buffImg) {
if (buffImg != null)
PlayerModelManager.analyseTexture(buffImg, resLocation);
return imgDownload.parseUserSkin(buffImg);
}
@Override
public void func_152634_a() {
imgDownload.func_152634_a();
if (callBack != null)
callBack.func_152121_a(type, isSpecialCallBack ? resLocation : resLocationOld);
}
});
textureManager.loadTexture(resLocation, imgData);
textureManager.loadTexture(resLocationOld, imgData); // Avoid thrown exception if the image is requested before the download is done
}
return isSpecialCallBack ? resLocation : resLocationOld;
}
项目:Nucleum-Omnium
文件:DevCapes.java
/**
* Used to download images. Copied from AbstractClientPlayer to remove
* a conditional.
*
* @param par0ResourceLocation
* @param par1Str
* @param par2ResourceLocation
* @param par3IImageBuffer
* @return
*/
private static ThreadDownloadImageData makeDownloadThread(ResourceLocation par0ResourceLocation, String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer)
{
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
TextureObject object = new ThreadDownloadImageData(par1Str, par2ResourceLocation, par3IImageBuffer);
// Binds ResourceLocation to this.
texturemanager.loadTexture(par0ResourceLocation, object);
return (ThreadDownloadImageData) object;
}
项目:DecompiledMinecraft
文件:SkinManager.java
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type p_152789_2_, final SkinManager.SkinAvailableCallback skinAvailableCallback)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash());
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)
{
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
else
{
File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx");
File file2 = new File(file1, profileTexture.getHash());
final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage image)
{
if (iimagebuffer != null)
{
image = iimagebuffer.parseUserSkin(image);
}
return image;
}
public void skinAvailable()
{
if (iimagebuffer != null)
{
iimagebuffer.skinAvailable();
}
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
});
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:BaseClient
文件:CapeUtils.java
public static void downloadCape(final AbstractClientPlayer p_downloadCape_0_)
{
String s = p_downloadCape_0_.getNameClear();
if (s != null && !s.isEmpty())
{
String s1 = "http://s.optifine.net/capes/" + s + ".png";
String s2 = FilenameUtils.getBaseName(s1);
final ResourceLocation resourcelocation = new ResourceLocation("capeof/" + s2);
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject itextureobject = texturemanager.getTexture(resourcelocation);
if (itextureobject != null && itextureobject instanceof ThreadDownloadImageData)
{
ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData)itextureobject;
if (threaddownloadimagedata.imageFound != null)
{
if (threaddownloadimagedata.imageFound.booleanValue())
{
p_downloadCape_0_.setLocationOfCape(resourcelocation);
}
return;
}
}
IImageBuffer iimagebuffer = new IImageBuffer()
{
ImageBufferDownload ibd = new ImageBufferDownload();
public BufferedImage parseUserSkin(BufferedImage image)
{
return CapeUtils.parseCape(image);
}
public void skinAvailable()
{
p_downloadCape_0_.setLocationOfCape(resourcelocation);
}
};
ThreadDownloadImageData threaddownloadimagedata1 = new ThreadDownloadImageData((File)null, s1, (ResourceLocation)null, iimagebuffer);
threaddownloadimagedata1.pipeline = true;
texturemanager.loadTexture(resourcelocation, threaddownloadimagedata1);
}
}
项目:BaseClient
文件:SkinManager.java
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type p_152789_2_, final SkinManager.SkinAvailableCallback skinAvailableCallback)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash());
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)
{
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
else
{
File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx");
File file2 = new File(file1, profileTexture.getHash());
final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage image)
{
if (iimagebuffer != null)
{
image = iimagebuffer.parseUserSkin(image);
}
return image;
}
public void skinAvailable()
{
if (iimagebuffer != null)
{
iimagebuffer.skinAvailable();
}
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
});
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:BaseClient
文件:AbstractClientPlayer.java
private void downloadCape(String p_downloadCape_1_)
{
if (p_downloadCape_1_ != null && !p_downloadCape_1_.isEmpty())
{
p_downloadCape_1_ = StringUtils.stripControlCodes(p_downloadCape_1_);
String s = "http://s.optifine.net/capes/" + p_downloadCape_1_ + ".png";
String s1 = FilenameUtils.getBaseName(s);
final ResourceLocation resourcelocation = new ResourceLocation("capeof/" + s1);
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject itextureobject = texturemanager.getTexture(resourcelocation);
if (itextureobject != null && itextureobject instanceof ThreadDownloadImageData)
{
ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData)itextureobject;
if (threaddownloadimagedata.imageFound != null)
{
if (threaddownloadimagedata.imageFound.booleanValue())
{
this.ofLocationCape = resourcelocation;
}
return;
}
}
IImageBuffer iimagebuffer = new IImageBuffer()
{
ImageBufferDownload ibd = new ImageBufferDownload();
public BufferedImage parseUserSkin(BufferedImage image)
{
return AbstractClientPlayer.this.parseCape(image);
}
public void skinAvailable()
{
AbstractClientPlayer.this.ofLocationCape = resourcelocation;
}
};
ThreadDownloadImageData threaddownloadimagedata1 = new ThreadDownloadImageData((File)null, s, (ResourceLocation)null, iimagebuffer);
texturemanager.loadTexture(resourcelocation, threaddownloadimagedata1);
}
}
项目:BaseClient
文件:SkinManager.java
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type p_152789_2_, final SkinManager.SkinAvailableCallback skinAvailableCallback)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash());
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)
{
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
else
{
File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx");
File file2 = new File(file1, profileTexture.getHash());
final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage image)
{
if (iimagebuffer != null)
{
image = iimagebuffer.parseUserSkin(image);
}
return image;
}
public void skinAvailable()
{
if (iimagebuffer != null)
{
iimagebuffer.skinAvailable();
}
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
});
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:Backmemed
文件:SkinManager.java
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, @Nullable final SkinManager.SkinAvailableCallback skinAvailableCallback)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash());
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)
{
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
}
}
else
{
File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx");
File file2 = new File(file1, profileTexture.getHash());
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage image)
{
if (iimagebuffer != null)
{
image = iimagebuffer.parseUserSkin(image);
}
return image;
}
public void skinAvailable()
{
if (iimagebuffer != null)
{
iimagebuffer.skinAvailable();
}
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
}
}
});
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:Backmemed
文件:CapeUtils.java
public static void downloadCape(final AbstractClientPlayer p_downloadCape_0_)
{
String s = p_downloadCape_0_.getNameClear();
if (s != null && !s.isEmpty())
{
String s1 = "http://s.optifine.net/capes/" + s + ".png";
String s2 = FilenameUtils.getBaseName(s1);
final ResourceLocation resourcelocation = new ResourceLocation("capeof/" + s2);
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject itextureobject = texturemanager.getTexture(resourcelocation);
if (itextureobject != null && itextureobject instanceof ThreadDownloadImageData)
{
ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData)itextureobject;
if (threaddownloadimagedata.imageFound != null)
{
if (threaddownloadimagedata.imageFound.booleanValue())
{
p_downloadCape_0_.setLocationOfCape(resourcelocation);
}
return;
}
}
IImageBuffer iimagebuffer = new IImageBuffer()
{
ImageBufferDownload ibd = new ImageBufferDownload();
public BufferedImage parseUserSkin(BufferedImage image)
{
return CapeUtils.parseCape(image);
}
public void skinAvailable()
{
p_downloadCape_0_.setLocationOfCape(resourcelocation);
}
};
ThreadDownloadImageData threaddownloadimagedata1 = new ThreadDownloadImageData((File)null, s1, (ResourceLocation)null, iimagebuffer);
threaddownloadimagedata1.pipeline = true;
texturemanager.loadTexture(resourcelocation, threaddownloadimagedata1);
}
}
项目:CustomWorldGen
文件:SkinManager.java
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, @Nullable final SkinManager.SkinAvailableCallback skinAvailableCallback)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash());
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)
{
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
}
}
else
{
File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx");
File file2 = new File(file1, profileTexture.getHash());
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage image)
{
if (iimagebuffer != null)
{
image = iimagebuffer.parseUserSkin(image);
}
return image;
}
public void skinAvailable()
{
if (iimagebuffer != null)
{
iimagebuffer.skinAvailable();
}
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
}
}
});
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:MineLittlePony
文件:PreviewTexture.java
public PreviewTexture(String url, ResourceLocation fallbackTexture, @Nullable IImageBuffer imageBuffer) {
super(null, url, fallbackTexture, imageBuffer);
}
项目:Resilience-Client-Source
文件:AbstractClientPlayer.java
public static ThreadDownloadImageData getDownloadImageCape(ResourceLocation par0ResourceLocation, String par1Str)
{
return getDownloadImage(par0ResourceLocation, getCapeUrl(par1Str), (ResourceLocation)null, (IImageBuffer)null);
}
项目:Resilience-Client-Source
文件:ThreadDownloadImage.java
public ThreadDownloadImage(ThreadDownloadImageData parent, String urlStr, IImageBuffer imageBuffer)
{
this.parent = parent;
this.urlStr = urlStr;
this.imageBuffer = imageBuffer;
}
项目:ExpandedRailsMod
文件:SkinManager.java
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, @Nullable final SkinManager.SkinAvailableCallback skinAvailableCallback)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash());
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)
{
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
}
}
else
{
File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx");
File file2 = new File(file1, profileTexture.getHash());
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage image)
{
if (iimagebuffer != null)
{
image = iimagebuffer.parseUserSkin(image);
}
return image;
}
public void skinAvailable()
{
if (iimagebuffer != null)
{
iimagebuffer.skinAvailable();
}
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
}
}
});
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:Cauldron
文件:SkinManager.java
public ResourceLocation func_152789_a(MinecraftProfileTexture p_152789_1_, final Type p_152789_2_, final SkinManager.SkinAvailableCallback p_152789_3_)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + p_152789_1_.getHash());
ITextureObject itextureobject = this.field_152795_c.getTexture(resourcelocation);
if (itextureobject != null)
{
if (p_152789_3_ != null)
{
p_152789_3_.func_152121_a(p_152789_2_, resourcelocation);
}
}
else
{
File file1 = new File(this.field_152796_d, p_152789_1_.getHash().substring(0, 2));
File file2 = new File(file1, p_152789_1_.getHash());
final ImageBufferDownload imagebufferdownload = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, p_152789_1_.getUrl(), field_152793_a, new IImageBuffer()
{
private static final String __OBFID = "CL_00001828";
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
{
if (imagebufferdownload != null)
{
p_78432_1_ = imagebufferdownload.parseUserSkin(p_78432_1_);
}
return p_78432_1_;
}
public void func_152634_a()
{
if (imagebufferdownload != null)
{
imagebufferdownload.func_152634_a();
}
if (p_152789_3_ != null)
{
p_152789_3_.func_152121_a(p_152789_2_, resourcelocation);
}
}
});
this.field_152795_c.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:Cauldron
文件:SkinManager.java
public ResourceLocation func_152789_a(MinecraftProfileTexture p_152789_1_, final Type p_152789_2_, final SkinManager.SkinAvailableCallback p_152789_3_)
{
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + p_152789_1_.getHash());
ITextureObject itextureobject = this.field_152795_c.getTexture(resourcelocation);
if (itextureobject != null)
{
if (p_152789_3_ != null)
{
p_152789_3_.func_152121_a(p_152789_2_, resourcelocation);
}
}
else
{
File file1 = new File(this.field_152796_d, p_152789_1_.getHash().substring(0, 2));
File file2 = new File(file1, p_152789_1_.getHash());
final ImageBufferDownload imagebufferdownload = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, p_152789_1_.getUrl(), field_152793_a, new IImageBuffer()
{
private static final String __OBFID = "CL_00001828";
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
{
if (imagebufferdownload != null)
{
p_78432_1_ = imagebufferdownload.parseUserSkin(p_78432_1_);
}
return p_78432_1_;
}
public void func_152634_a()
{
if (imagebufferdownload != null)
{
imagebufferdownload.func_152634_a();
}
if (p_152789_3_ != null)
{
p_152789_3_.func_152121_a(p_152789_2_, resourcelocation);
}
}
});
this.field_152795_c.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
项目:RuneCraftery
文件:AbstractClientPlayer.java
public static ThreadDownloadImageData func_110307_b(ResourceLocation p_110307_0_, String p_110307_1_) {
return func_110301_a(p_110307_0_, func_110308_e(p_110307_1_), (ResourceLocation)null, (IImageBuffer)null);
}
项目:RuneCraftery
文件:ThreadDownloadImageData.java
public ThreadDownloadImageData(String p_i1273_1_, ResourceLocation p_i1273_2_, IImageBuffer p_i1273_3_) {
this.field_110562_b = p_i1273_1_;
this.field_110563_c = p_i1273_3_;
this.field_110558_f = p_i1273_2_ != null?new SimpleTexture(p_i1273_2_):null;
}
项目:RuneCraftery
文件:ThreadDownloadImageData.java
static IImageBuffer func_110555_b(ThreadDownloadImageData p_110555_0_) {
return p_110555_0_.field_110563_c;
}
项目:RuneCraftery
文件:AbstractClientPlayer.java
public static ThreadDownloadImageData getDownloadImageCape(ResourceLocation par0ResourceLocation, String par1Str)
{
return getDownloadImage(par0ResourceLocation, getCapeUrl(par1Str), (ResourceLocation)null, (IImageBuffer)null);
}
项目:Statues
文件:StatueTextureStatic.java
public StatueTextureStatic(ResourceLocation loc,IImageBuffer e) {
location=loc;
effect = e;
}
项目:epc2eu
文件:BonusEvent.java
public static ThreadDownloadImageData getDownloadImageCape(ResourceLocation resourceLocation, String playerName)
{
return getDownloadImage(resourceLocation, getCapeUrl(playerName), (ResourceLocation)null, (IImageBuffer)null);
}
项目:BetterNutritionMod
文件:AbstractClientPlayer.java
public static ThreadDownloadImageData getDownloadImageCape(ResourceLocation par0ResourceLocation, String par1Str)
{
return getDownloadImage(par0ResourceLocation, getCapeUrl(par1Str), (ResourceLocation)null, (IImageBuffer)null);
}
项目:Bookshelf
文件:RenderUtils.java
/**
* Attempts to download a resource from the web and load it into the game. If the resource
* can not be downloaded successfully. Wraps
* {@link #downloadResource(String, ResourceLocation, ResourceLocation, IImageBuffer)} but
* returns the output ResourceLocation.
*
* @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 output resource location.
*/
public static ResourceLocation downloadResourceLocation (String url, ResourceLocation outputResource, ResourceLocation defaultResource, IImageBuffer buffer) {
downloadResource(url, outputResource, defaultResource, buffer);
return outputResource;
}