当前位置: 首页>>代码示例>>Java>>正文


Java ThreadDownloadImageData类代码示例

本文整理汇总了Java中net.minecraft.client.renderer.ThreadDownloadImageData的典型用法代码示例。如果您正苦于以下问题:Java ThreadDownloadImageData类的具体用法?Java ThreadDownloadImageData怎么用?Java ThreadDownloadImageData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ThreadDownloadImageData类属于net.minecraft.client.renderer包,在下文中一共展示了ThreadDownloadImageData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: downloadCape

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
public ThreadDownloadImageData downloadCape() 
{
	try {
		File capeFile = new File(resourceLocation.getResourcePath() + ".png");
		
		if(capeFile.exists())
		{
			capeFile.delete();
		}
		
		TextureManager manager = Minecraft.getMinecraft().getTextureManager();
		ThreadDownloadImageData data = new ThreadDownloadImageData(capeFile, staticCapeUrl, null, null);

		manager.loadTexture(resourceLocation, data);
		
		return data;
	} catch(Exception e) {
		e.printStackTrace();
	}
	
	return null;
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:23,代码来源:CapeBufferDownload.java

示例2: loadCape

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
/**
 * Fetches a cape for the given player and stores it's ResourceLocation in
 * the capes map
 *
 * @param uuid UUID of the player to load the cape for
 */
public static void loadCape(final UUID uuid) {
  if (CapesAPI.hasPendingRequests(uuid)) {
    return;
  }

  CapesAPI.setCape(uuid, null);
  String url = String.format(CapesAPI.BASE_URL, uuid);
  ResourceLocation resourceLocation = new ResourceLocation(
          String.format("capesapi/capes/%s.png", new Date().getTime())
  );
  TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
  ThreadDownloadImageData threadDownloadImageData = new ThreadDownloadImageData(null, url, null, new IImageBuffer() {
    @Override
    public BufferedImage parseUserSkin(BufferedImage image) {
      return image;
    }

    @Override
    public void skinAvailable() {
      CapesAPI.setCape(uuid, resourceLocation);
      
      // useless reloading Image whenever a Player dies, joins, leaves and re-enters Render range 
      // CapesAPI.pendingRequests.remove(uuid);
    }
  });
  textureManager.loadTexture(resourceLocation, threadDownloadImageData);
  CapesAPI.pendingRequests.add(uuid);
}
 
开发者ID:halfpetal,项目名称:CapesAPI-ClientImplementation,代码行数:35,代码来源:CapesAPI.java

示例3: getBufferedImage

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
@Nullable
private BufferedImage getBufferedImage(@Nonnull ResourceLocation textureResourceLocation) {
    BufferedImage skinImage = null;
    try {
        IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation);
        skinImage = TextureUtil.readBufferedImage(skin.getInputStream());
        MineLittlePony.logger.debug("Obtained skin from resource location {}", textureResourceLocation);
        // this.checkSkin(skinImage);
    } catch (IOException e) {

        try {
            ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(textureResourceLocation);
            if (e2 instanceof ThreadDownloadImageData) {

                skinImage = PonyFields.downloadedImage.get((ThreadDownloadImageData) e2);
                if (skinImage != null) {
                    MineLittlePony.logger.debug("Successfully reflected downloadedImage from texture object", e);
                    // this.checkSkin(skinImage);
                }
            } else if (e2 instanceof ThreadDownloadImageETag) {
                skinImage = ((ThreadDownloadImageETag) e2).getBufferedImage();
            } else if (e2 instanceof DynamicTextureImage) {
                skinImage = ((DynamicTextureImage) e2).getImage();
            }
        } catch (Exception ignored) {

        }
    }

    return skinImage;
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:32,代码来源:Pony.java

示例4: setURL

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
public void setURL (URL url) {
	if (url == null) {
		this.texture = null;
		return;
	}
	this.texture = new ThreadDownloadImageData(null, url.toString(), null, new HDImageBuffer());
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:8,代码来源:StaticCape.java

示例5: getDownloadImageSkin

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
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());
}
 
开发者ID:EchebKeso,项目名称:Mocap,代码行数:14,代码来源:RenderEntityMocap.java

示例6: setURL

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
public void setURL(URL url) {
    if (url == null) {
        this.texture = null;
        return;
    }
    this.texture = new ThreadDownloadImageData(null, url.toString(), null, new HDImageBuffer());
}
 
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:8,代码来源:StaticCape.java

示例7: registerTeamCapes

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
/**
 * Adds capes to our team Player Entities. May become invalid as soon as the
 * UUID system is fully implemented by Mojang.
 */
@Override
public void registerTeamCapes()
{
    final String capeURL = "http://www.mccapes.com/GalleryImages6x/0c1865261d2d0247fb6b776bdc5d6730.png"; // Temporary.
                                                                                                          // Can
                                                                                                          // someone
                                                                                                          // make
                                                                                                          // us
                                                                                                          // a
                                                                                                          // proper
                                                                                                          // cape?
                                                                                                          // We
                                                                                                          // should
                                                                                                          // be
                                                                                                          // able
                                                                                                          // to
                                                                                                          // have
                                                                                                          // a
                                                                                                          // HD
                                                                                                          // one
                                                                                                          // I
                                                                                                          // think!

    String[] teamMembers =
        { "nxsupert, ProfessorVennie", "roborave", "InternetAthiest",
                "MushroomLT" }; // Please add your minecraft user names
                                // here. You will get a cape if you do so!

    ThreadDownloadImageData capeImage = new ThreadDownloadImageData(
            capeURL, null, null);
    Minecraft mcInstance = Minecraft.getMinecraft();

    for (String username : teamMembers)
    {
        mcInstance.renderEngine.loadTexture(new ResourceLocation("cloaks/"
                + username), capeImage);
    }
}
 
开发者ID:CoreModding,项目名称:CORE-API,代码行数:43,代码来源:ClientProxy.java

示例8: run

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
public void run() {
   HttpURLConnection var1 = null;

   try {
      var1 = (HttpURLConnection)(new URL(ThreadDownloadImageData.func_110554_a(this.field_110932_a))).openConnection(Minecraft.func_71410_x().func_110437_J());
      var1.setDoInput(true);
      var1.setDoOutput(false);
      var1.connect();
      if(var1.getResponseCode() / 100 != 2) {
         return;
      }

      BufferedImage var2 = ImageIO.read(var1.getInputStream());
      if(ThreadDownloadImageData.func_110555_b(this.field_110932_a) != null) {
         var2 = ThreadDownloadImageData.func_110555_b(this.field_110932_a).func_78432_a(var2);
      }

      this.field_110932_a.func_110556_a(var2);
   } catch (Exception var6) {
      var6.printStackTrace();
   } finally {
      if(var1 != null) {
         var1.disconnect();
      }

   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:29,代码来源:ThreadDownloadImageDataINNER1.java

示例9: loadTexture

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
@Override
public void loadTexture(AbstractClientPlayer player)
{
    if (this.texture == null)
    {
        this.texture = readImageData(capeImage);
    }

    ThreadDownloadImageData data = player.getTextureCape();
    data.setBufferedImage(this.capeImage);
    TextureUtil.uploadTexture(data.getGlTextureId(), this.texture, capeImage.getWidth(), capeImage.getHeight());
}
 
开发者ID:jadar,项目名称:RankCapes,代码行数:13,代码来源:StaticCape.java

示例10: DevCapes

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
/**
 * Object constructor.
 */
private DevCapes()
{
    users = new HashMap<String, String>();
    capeResources = new HashMap<String, ResourceLocation>();
    downloadThreads = new HashMap<String, ThreadDownloadImageData>();
}
 
开发者ID:CCM-Modding,项目名称:Nucleum-Omnium,代码行数:10,代码来源:DevCapes.java

示例11: addDownloadThread

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
/**
 * Adds an ThreadDownloadImageData. Needed to change cape.
 *
 * @param parGroup
 * @param parResource
 */
void addDownloadThread(String parGroup, ThreadDownloadImageData parResource)
{
    if (getDownloadThread(parGroup) == null)
    {
        downloadThreads.put(parGroup, parResource);
    }
}
 
开发者ID:CCM-Modding,项目名称:Nucleum-Omnium,代码行数:14,代码来源:DevCapes.java

示例12: makeDownloadThread

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
/**
 * Used to download images. Copied from AbstractClientPlayer to remove
 * a conditional.
 *
 * @param par0ResourceLocation
 * @param par1Str
 * @param par2ResourceLocation
 * @param par3IImageBuffer
 * @return
 */
private static ThreadDownloadImageData makeDownloadThread(ResourceLocation par0ResourceLocation, String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer)
{
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();

    TextureObject object = new ThreadDownloadImageData(par1Str, par2ResourceLocation, par3IImageBuffer);
    // Binds ResourceLocation to this.
    texturemanager.loadTexture(par0ResourceLocation, object);

    return (ThreadDownloadImageData) object;
}
 
开发者ID:CCM-Modding,项目名称:Nucleum-Omnium,代码行数:21,代码来源:DevCapes.java

示例13: loadSkin

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:SkinManager.java

示例14: downloadCape

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:45,代码来源:CapeUtils.java

示例15: downloadCape

import net.minecraft.client.renderer.ThreadDownloadImageData; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:43,代码来源:AbstractClientPlayer.java


注:本文中的net.minecraft.client.renderer.ThreadDownloadImageData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。