@Override public CachedImage load(Image image) { if(CACHE.containsKey(url)) { CachedImage cachedImage = CACHE.get(url); image.imageWidth = cachedImage.width; image.imageHeight = cachedImage.height; return cachedImage; } try { texture.loadTexture(Minecraft.getMinecraft().getResourceManager()); CachedImage cachedImage = new CachedImage(texture.getGlTextureId(), image.imageWidth, image.imageHeight, true); CACHE.put(url, cachedImage); return cachedImage; } catch(IOException e) { return new CachedImage(TextureUtil.MISSING_TEXTURE.getGlTextureId(), 0, 0, true); } } }
@Override public CachedImage load(Image image) { ITextureObject textureObj = Minecraft.getMinecraft().getTextureManager().getTexture(resource); if(textureObj != null) { return new CachedImage(textureObj.getGlTextureId(), 0, 0, false); } else { AbstractTexture texture = new SimpleTexture(resource); if(Minecraft.getMinecraft().getTextureManager().loadTexture(resource, texture)) { return new CachedImage(texture.getGlTextureId(), 0, 0, false); } return new CachedImage(TextureUtil.MISSING_TEXTURE.getGlTextureId(), 0, 0, false); } } }