net.minecraft.client.renderer.texture.ITextureObject Java Examples
The following examples show how to use
net.minecraft.client.renderer.texture.ITextureObject.
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: MemoryHelper.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
private void deleteSkin(ResourceLocation skinLocation) { if (skinLocation == null) return; TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); Map<ResourceLocation, ITextureObject> mapTextureObjects = ((IMixinTextureManager) textureManager).getMapTextureObjects(); textureManager.deleteTexture(skinLocation); mapTextureObjects.remove(skinLocation); // not needed with optifine but needed without it }
Example #2
Source File: MapDownloader.java From ForgeHax with MIT License | 5 votes |
private ResourceLocation findResourceLocation(String name) { Map<ResourceLocation, ITextureObject> mapTextureObjects = FastReflection.Fields.TextureManager_mapTextureObjects.get(MC.getTextureManager()); return mapTextureObjects .keySet() .stream() .filter(k -> k.getResourcePath().contains(name)) .findFirst() .orElse(null); }
Example #3
Source File: MapMod.java From ForgeHax with MIT License | 5 votes |
private void updateHeldMapTexture(String url) { if (MC.player == null || !(MC.player.getHeldItemMainhand().getItem() instanceof ItemMap)) { return; } MC.addScheduledTask( () -> { // allows DynamicTexture to work ItemMap map = (ItemMap) MC.player.getHeldItemMainhand().getItem(); MapData heldMapData = map.getMapData(MC.player.getHeldItemMainhand(), MC.world); try { BufferedImage image = getImageFromUrl(url); DynamicTexture dynamicTexture = new DynamicTexture(image); dynamicTexture.loadTexture(MC.getResourceManager()); Map<ResourceLocation, ITextureObject> mapTextureObjects = FastReflection.Fields.TextureManager_mapTextureObjects.get(MC.getTextureManager()); ResourceLocation textureLocation = mapTextureObjects .keySet() .stream() .filter(k -> k.getResourcePath().contains(heldMapData.mapName)) .findFirst() .orElse(null); mapTextureObjects.put( textureLocation, dynamicTexture); // overwrite old texture with our custom one } catch (Exception e) { e.printStackTrace(); } }); }
Example #4
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 #5
Source File: AbstractCape.java From DeveloperCapes with MIT License | 4 votes |
@Override public ITextureObject getTexture() { return this.texture; }
Example #6
Source File: IMixinTextureManager.java From Hyperium with GNU Lesser General Public License v3.0 | votes |
@Accessor Map<ResourceLocation, ITextureObject> getMapTextureObjects();
Example #7
Source File: ICape.java From DeveloperCapes with MIT License | votes |
public ITextureObject getTexture();