Ejemplo n.º 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;
  }
    public TeamSelectionObject(ScorePlayerTeam p_i45492_2_) {
      this.team = p_i45492_2_;
      this.players = Lists.<NetworkPlayerInfo>newArrayList();

      for (String s : p_i45492_2_.getMembershipCollection()) {
        NetworkPlayerInfo networkplayerinfo =
            Minecraft.getMinecraft().getConnection().getPlayerInfo(s);

        if (networkplayerinfo != null) {
          this.players.add(networkplayerinfo);
        }
      }

      if (this.players.isEmpty()) {
        this.location = DefaultPlayerSkin.getDefaultSkinLegacy();
      } else {
        String s1 =
            ((NetworkPlayerInfo) this.players.get((new Random()).nextInt(this.players.size())))
                .getGameProfile()
                .getName();
        this.location = AbstractClientPlayer.getLocationSkin(s1);
        AbstractClientPlayer.getDownloadImageSkin(this.location, s1);
      }
    }
  public void renderSkull(
      float p_180543_1_,
      float p_180543_2_,
      float p_180543_3_,
      EnumFacing p_180543_4_,
      float p_180543_5_,
      int p_180543_6_,
      GameProfile p_180543_7_,
      int p_180543_8_) {
    ModelBase modelbase = this.skeletonHead;

    if (p_180543_8_ >= 0) {
      this.bindTexture(DESTROY_STAGES[p_180543_8_]);
      GlStateManager.matrixMode(5890);
      GlStateManager.pushMatrix();
      GlStateManager.scale(4.0F, 2.0F, 1.0F);
      GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
      GlStateManager.matrixMode(5888);
    } else {
      switch (p_180543_6_) {
        case 0:
        default:
          this.bindTexture(SKELETON_TEXTURES);
          break;
        case 1:
          this.bindTexture(WITHER_SKELETON_TEXTURES);
          break;
        case 2:
          this.bindTexture(ZOMBIE_TEXTURES);
          modelbase = this.humanoidHead;
          break;
        case 3:
          modelbase = this.humanoidHead;
          ResourceLocation resourcelocation = DefaultPlayerSkin.getDefaultSkinLegacy();

          if (p_180543_7_ != null) {
            Minecraft minecraft = Minecraft.getMinecraft();
            Map<Type, MinecraftProfileTexture> map =
                minecraft.getSkinManager().loadSkinFromCache(p_180543_7_);

            if (map.containsKey(Type.SKIN)) {
              resourcelocation =
                  minecraft
                      .getSkinManager()
                      .loadSkin((MinecraftProfileTexture) map.get(Type.SKIN), Type.SKIN);
            } else {
              UUID uuid = EntityPlayer.getUUID(p_180543_7_);
              resourcelocation = DefaultPlayerSkin.getDefaultSkin(uuid);
            }
          }

          this.bindTexture(resourcelocation);
          break;
        case 4:
          this.bindTexture(CREEPER_TEXTURES);
      }
    }

    GlStateManager.pushMatrix();
    GlStateManager.disableCull();

    if (p_180543_4_ != EnumFacing.UP) {
      switch (p_180543_4_) {
        case NORTH:
          GlStateManager.translate(p_180543_1_ + 0.5F, p_180543_2_ + 0.25F, p_180543_3_ + 0.74F);
          break;
        case SOUTH:
          GlStateManager.translate(p_180543_1_ + 0.5F, p_180543_2_ + 0.25F, p_180543_3_ + 0.26F);
          p_180543_5_ = 180.0F;
          break;
        case WEST:
          GlStateManager.translate(p_180543_1_ + 0.74F, p_180543_2_ + 0.25F, p_180543_3_ + 0.5F);
          p_180543_5_ = 270.0F;
          break;
        case EAST:
        default:
          GlStateManager.translate(p_180543_1_ + 0.26F, p_180543_2_ + 0.25F, p_180543_3_ + 0.5F);
          p_180543_5_ = 90.0F;
      }
    } else {
      GlStateManager.translate(p_180543_1_ + 0.5F, p_180543_2_, p_180543_3_ + 0.5F);
    }

    float f = 0.0625F;
    GlStateManager.enableRescaleNormal();
    GlStateManager.scale(-1.0F, -1.0F, 1.0F);
    GlStateManager.enableAlpha();
    modelbase.render((Entity) null, 0.0F, 0.0F, 0.0F, p_180543_5_, 0.0F, f);
    GlStateManager.popMatrix();

    if (p_180543_8_ >= 0) {
      GlStateManager.matrixMode(5890);
      GlStateManager.popMatrix();
      GlStateManager.matrixMode(5888);
    }
  }