BannerTextures.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:Backmemed 作者:
@Nullable
public ResourceLocation getResourceLocation(String id, List<BannerPattern> patternList, List<EnumDyeColor> colorList)
{
    if (id.isEmpty())
    {
        return null;
    }
    else
    {
        id = this.cacheId + id;
        BannerTextures.CacheEntry bannertextures$cacheentry = (BannerTextures.CacheEntry)this.cacheMap.get(id);

        if (bannertextures$cacheentry == null)
        {
            if (this.cacheMap.size() >= 256 && !this.freeCacheSlot())
            {
                return BannerTextures.BANNER_BASE_TEXTURE;
            }

            List<String> list = Lists.<String>newArrayList();

            for (BannerPattern bannerpattern : patternList)
            {
                list.add(this.cacheResourceBase + bannerpattern.func_190997_a() + ".png");
            }

            bannertextures$cacheentry = new BannerTextures.CacheEntry();
            bannertextures$cacheentry.textureLocation = new ResourceLocation(id);
            Minecraft.getMinecraft().getTextureManager().loadTexture(bannertextures$cacheentry.textureLocation, new LayeredColorMaskTexture(this.cacheResourceLocation, list, colorList));
            this.cacheMap.put(id, bannertextures$cacheentry);
        }

        bannertextures$cacheentry.lastUseMillis = System.currentTimeMillis();
        return bannertextures$cacheentry.textureLocation;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号