net.minecraft.client.renderer.IImageBuffer Java Examples
The following examples show how to use
net.minecraft.client.renderer.IImageBuffer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NewThreadDownloadImageData.java From Et-Futurum with The Unlicense | 5 votes |
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; }
Example #2
Source File: NewSkinManager.java From Et-Futurum with The Unlicense | 5 votes |
@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; }
Example #3
Source File: HyperiumCapeHandler.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
public HyperiumCapeHandler(GameProfile profile) { Multithreading.runAsync(() -> { HyperiumPurchase purchase = PurchaseApi.getInstance().getPackageSync(profile.getId()); JsonHolder holder = purchase.getPurchaseSettings().optJSONObject("cape"); String type = holder.optString("type"); String url = null; if (type.equals("CUSTOM_IMAGE")) { url = holder.optString("url"); } else if (!type.isEmpty()) { JsonHolder atlasHolder = PurchaseApi.getInstance().getCapeAtlas().optJSONObject(type); url = atlasHolder.optString("url"); if (url.isEmpty()) return; } ResourceLocation resourceLocation = new ResourceLocation(String.format("hyperium/capes/%s.png", profile.getId())); TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); ThreadDownloadImageData threadDownloadImageData = new ThreadDownloadImageData(null, url, null, new IImageBuffer() { @Override public BufferedImage parseUserSkin(BufferedImage image) { return HyperiumCapeUtils.parseCape(image); } @Override public void skinAvailable() { LOCATION_CACHE.add(location = resourceLocation); ready = true; } }); try { textureManager.loadTexture(resourceLocation, threadDownloadImageData); } catch (Exception e) { e.printStackTrace(); } }); }
Example #4
Source File: IMixinThreadDownloadImageData.java From Hyperium with GNU Lesser General Public License v3.0 | votes |
@Accessor IImageBuffer getImageBuffer();