コード例 #1
0
  private static ThreadDownloadImageData getDownloadImage(
      ResourceLocation par0ResourceLocation,
      String par1Str,
      ResourceLocation par2ResourceLocation,
      IImageBuffer par3IImageBuffer) {
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    Object object = texturemanager.getTexture(par0ResourceLocation);

    if (object == null) {
      object = new ThreadDownloadImageData(par1Str, par2ResourceLocation, par3IImageBuffer);
      texturemanager.loadTexture(par0ResourceLocation, (ITextureObject) object);
    }

    return (ThreadDownloadImageData) object;
  }
コード例 #2
0
  @SideOnly(Side.CLIENT)
  private ThreadDownloadImageData func_110301_a(
      ResourceLocation par0ResourceLocation,
      String par1Str,
      ResourceLocation par2ResourceLocation,
      IImageBuffer par3IImageBuffer) {
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    Object object = texturemanager.getTexture(par0ResourceLocation);

    if (object == null) {
      object = new ThreadDownloadImageData(null, par1Str, par2ResourceLocation, par3IImageBuffer);
      texturemanager.loadTexture(par0ResourceLocation, (ITextureObject) object);
    }

    return (ThreadDownloadImageData) object;
  }
コード例 #3
0
  @Override
  public ResourceLocation func_152789_a(
      MinecraftProfileTexture texture,
      final Type type,
      final NewSkinManager.SkinAvailableCallback callBack) {
    final ResourceLocation resLocation = new ResourceLocation("skins/" + texture.getHash());
    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 =
          type == Type.SKIN ? new NewImageBufferDownload() : null;
      ThreadDownloadImageData imgData =
          new ThreadDownloadImageData(
              file2,
              texture.getUrl(),
              field_152793_a,
              new IImageBuffer() {

                @Override
                public BufferedImage parseUserSkin(BufferedImage buffImg) {
                  if (imgDownload != null) buffImg = imgDownload.parseUserSkin(buffImg);

                  return buffImg;
                }

                @Override
                public void func_152634_a() {
                  if (imgDownload != null) imgDownload.func_152634_a();

                  if (callBack != null) callBack.func_152121_a(type, resLocation);
                }
              });
      textureManager.loadTexture(resLocation, imgData);
    }

    return resLocation;
  }