當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureManager.loadTexture方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.texture.TextureManager.loadTexture方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureManager.loadTexture方法的具體用法?Java TextureManager.loadTexture怎麽用?Java TextureManager.loadTexture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.texture.TextureManager的用法示例。


在下文中一共展示了TextureManager.loadTexture方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadCape

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的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

示例2: downloadCape

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的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

示例3: downloadCape

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的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.texture.TextureManager.loadTexture方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。