当前位置: 首页>>代码示例>>Java>>正文


Java MinecraftProfileTexture.getHash方法代码示例

本文整理汇总了Java中com.mojang.authlib.minecraft.MinecraftProfileTexture.getHash方法的典型用法代码示例。如果您正苦于以下问题:Java MinecraftProfileTexture.getHash方法的具体用法?Java MinecraftProfileTexture.getHash怎么用?Java MinecraftProfileTexture.getHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mojang.authlib.minecraft.MinecraftProfileTexture的用法示例。


在下文中一共展示了MinecraftProfileTexture.getHash方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: func_152789_a

import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:40,代码来源:NewSkinManager.java

示例2: loadTexture

import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:38,代码来源:HDSkinManager.java

示例3: loadSkin

import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:SkinManager.java

示例4: loadSkin

import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:50,代码来源:SkinManager.java

示例5: func_152789_a

import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
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;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:48,代码来源:SkinManager.java


注:本文中的com.mojang.authlib.minecraft.MinecraftProfileTexture.getHash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。