public static void init() { // Clear all lists listDevs.clear(); listTesters.clear(); // Retrieve all players in the lists try { retrievePlayerData(); } catch (IOException e) { e.printStackTrace(); } // Obtain texture files Minecraft.getMinecraft().renderEngine.obtainImageData(Reference.PATH_CAPES_DEV, new ImageBufferDownload()); Minecraft.getMinecraft().renderEngine.obtainImageData(Reference.PATH_CAPES_TESTER, new ImageBufferDownload()); // Register tickhandler to set the capes TickRegistry.registerTickHandler(new CapeTickHandler(), Side.CLIENT); }
public static ThreadDownloadImageData getDownloadImageSkin( ResourceLocation par0ResourceLocation, String par1Str) { String theUrl = ""; if (par1Str.matches("\\d{10,}")) { theUrl = getSkindexUrl(par1Str); } else { theUrl = getSkinUrl(par1Str); } return getDownloadImage(par0ResourceLocation, theUrl, locationStevePng, new ImageBufferDownload()); }
/** * 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; }
public static void downloadCape(final AbstractClientPlayer p_downloadCape_0_) { String s = p_downloadCape_0_.getNameClear(); if (s != null && !s.isEmpty()) { String s1 = "http://s.optifine.net/capes/" + s + ".png"; String s2 = FilenameUtils.getBaseName(s1); final ResourceLocation resourcelocation = new ResourceLocation("capeof/" + s2); TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); ITextureObject itextureobject = texturemanager.getTexture(resourcelocation); if (itextureobject != null && itextureobject instanceof ThreadDownloadImageData) { ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData)itextureobject; if (threaddownloadimagedata.imageFound != null) { if (threaddownloadimagedata.imageFound.booleanValue()) { p_downloadCape_0_.setLocationOfCape(resourcelocation); } return; } } IImageBuffer iimagebuffer = new IImageBuffer() { ImageBufferDownload ibd = new ImageBufferDownload(); public BufferedImage parseUserSkin(BufferedImage image) { return CapeUtils.parseCape(image); } public void skinAvailable() { p_downloadCape_0_.setLocationOfCape(resourcelocation); } }; ThreadDownloadImageData threaddownloadimagedata1 = new ThreadDownloadImageData((File)null, s1, (ResourceLocation)null, iimagebuffer); threaddownloadimagedata1.pipeline = true; texturemanager.loadTexture(resourcelocation, threaddownloadimagedata1); } }
private void downloadCape(String p_downloadCape_1_) { if (p_downloadCape_1_ != null && !p_downloadCape_1_.isEmpty()) { p_downloadCape_1_ = StringUtils.stripControlCodes(p_downloadCape_1_); String s = "http://s.optifine.net/capes/" + p_downloadCape_1_ + ".png"; String s1 = FilenameUtils.getBaseName(s); final ResourceLocation resourcelocation = new ResourceLocation("capeof/" + s1); TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); ITextureObject itextureobject = texturemanager.getTexture(resourcelocation); if (itextureobject != null && itextureobject instanceof ThreadDownloadImageData) { ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData)itextureobject; if (threaddownloadimagedata.imageFound != null) { if (threaddownloadimagedata.imageFound.booleanValue()) { this.ofLocationCape = resourcelocation; } return; } } IImageBuffer iimagebuffer = new IImageBuffer() { ImageBufferDownload ibd = new ImageBufferDownload(); public BufferedImage parseUserSkin(BufferedImage image) { return AbstractClientPlayer.this.parseCape(image); } public void skinAvailable() { AbstractClientPlayer.this.ofLocationCape = resourcelocation; } }; ThreadDownloadImageData threaddownloadimagedata1 = new ThreadDownloadImageData((File)null, s, (ResourceLocation)null, iimagebuffer); texturemanager.loadTexture(resourcelocation, threaddownloadimagedata1); } }
/** * 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; }
public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation par0ResourceLocation, String par1Str) { return getDownloadImage(par0ResourceLocation, getSkinUrl(par1Str), locationStevePng, new ImageBufferDownload()); }
private static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation par0ResourceLocation, String par1Str) { return getDownloadImage(par0ResourceLocation, getSkinUrl(par1Str), STEVE, new ImageBufferDownload()); }
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; }
public static ThreadDownloadImageData func_110304_a(ResourceLocation p_110304_0_, String p_110304_1_) { return func_110301_a(p_110304_0_, func_110300_d(p_110304_1_), field_110314_b, new ImageBufferDownload()); }
public static void updateSkins(World world){ List<EntityPlayer> players = world.playerEntities; for(EntityPlayer p : players){ if(p.skinUrl!="http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"){ try{ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; URL url = new URL(SkinURL); HttpURLConnection con = ((HttpURLConnection) url.openConnection()); con.setConnectTimeout(1000); con.setRequestMethod("HEAD"); try{ int responseCode = con.getResponseCode(); if (responseCode ==200){ p.skinUrl = SkinURL; p.worldObj.obtainEntitySkin(p); }else{ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; p.skinUrl = SkinURL; p.worldObj.obtainEntitySkin(p); } }catch (SocketTimeoutException ste){ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; p.skinUrl = SkinURL; p.worldObj.obtainEntitySkin(p); } }catch (IOException e){ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; p.skinUrl = SkinURL; p.worldObj.obtainEntitySkin(p); } p.cloakUrl = "http://home.maemesoft.wo.tc:25564/MinecraftCloaks/" + p.username + ".png"; p.cloakUrl = p.cloakUrl; mc1 = ModLoader.getMinecraftInstance();; mc1.renderEngine.obtainImageData(p.cloakUrl, new ImageBufferDownload()); } } }
public static void forceUpdateSkins(World world){ List<EntityPlayer> players = world.playerEntities; for(EntityPlayer p : players){ if(p.skinUrl!="http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"){ try{ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; URL url = new URL(SkinURL); HttpURLConnection con = ((HttpURLConnection) url.openConnection()); con.setConnectTimeout(1000); con.setRequestMethod("HEAD"); try{ int responseCode = con.getResponseCode(); if (responseCode ==200){ p.skinUrl = SkinURL; p.worldObj.releaseEntitySkin(p); p.worldObj.obtainEntitySkin(p); }else{ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; p.skinUrl = SkinURL; p.worldObj.releaseEntitySkin(p); p.worldObj.obtainEntitySkin(p); } }catch (SocketTimeoutException ste){ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; p.skinUrl = SkinURL; p.worldObj.releaseEntitySkin(p); p.worldObj.obtainEntitySkin(p); } }catch (IOException e){ SkinURL = "http://home.maemesoft.wo.tc:25564/MinecraftSkins/" + p.username + ".png"; p.skinUrl = SkinURL; p.worldObj.releaseEntitySkin(p); p.worldObj.obtainEntitySkin(p); } p.cloakUrl = "http://home.maemesoft.wo.tc:25564/MinecraftCloaks/" + p.username + ".png"; p.cloakUrl = p.cloakUrl; mc1 = ModLoader.getMinecraftInstance();; mc1.renderEngine.obtainImageData(p.cloakUrl, new ImageBufferDownload()); }else{ p.worldObj.releaseEntitySkin(p); p.worldObj.obtainEntitySkin(p); } } }