Пример #1
0
  public ResourceLocation func_152789_a(
      final MinecraftProfileTexture p_152789_1_,
      final Type p_152789_2_,
      final SkinManager.SkinAvailableCallback p_152789_3_) {
    final ResourceLocation var4 = new ResourceLocation("skins/" + p_152789_1_.getHash());
    ITextureObject var5 = this.field_152795_c.func_110581_b(var4);
    if (var5 != null) {
      if (p_152789_3_ != null) {
        p_152789_3_.func_180521_a(p_152789_2_, var4, p_152789_1_);
      }
    } else {
      File var6 = new File(this.field_152796_d, p_152789_1_.getHash().substring(0, 2));
      File var7 = new File(var6, p_152789_1_.getHash());
      final ImageBufferDownload var8 = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
      ThreadDownloadImageData var9 =
          new ThreadDownloadImageData(
              var7,
              p_152789_1_.getUrl(),
              DefaultPlayerSkin.func_177335_a(),
              new IImageBuffer() {

                private static final String __OBFID = "CL_00001828";

                public BufferedImage func_78432_a(BufferedImage p_78432_1_) {
                  if (var8 != null) {
                    p_78432_1_ = var8.func_78432_a(p_78432_1_);
                  }

                  return p_78432_1_;
                }

                public void func_152634_a() {
                  if (var8 != null) {
                    var8.func_152634_a();
                  }

                  if (p_152789_3_ != null) {
                    p_152789_3_.func_180521_a(p_152789_2_, var4, p_152789_1_);
                  }
                }
              });
      this.field_152795_c.func_110579_a(var4, var9);
    }

    return var4;
  }
Пример #2
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;
  }