Exemplo n.º 1
0
  /** Queries whether should render the specified pass or not. */
  protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3) {
    ItemStack itemstack = par1EntityLiving.getCurrentArmor(3 - par2);

    if (itemstack != null) {
      Item item = itemstack.getItem();

      if (item instanceof ItemArmor) {
        ItemArmor itemarmor = (ItemArmor) item;
        this.loadTexture(
            ForgeHooksClient.getArmorTexture(
                itemstack,
                "/armor/"
                    + bipedArmorFilenamePrefix[itemarmor.renderIndex]
                    + "_"
                    + (par2 == 2 ? 2 : 1)
                    + ".png"));
        ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g;
        modelbiped.bipedHead.showModel = par2 == 0;
        modelbiped.bipedHeadwear.showModel = par2 == 0;
        modelbiped.bipedBody.showModel = par2 == 1 || par2 == 2;
        modelbiped.bipedRightArm.showModel = par2 == 1;
        modelbiped.bipedLeftArm.showModel = par2 == 1;
        modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
        modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
        this.setRenderPassModel(modelbiped);

        if (modelbiped != null) {
          modelbiped.onGround = this.mainModel.onGround;
        }

        if (modelbiped != null) {
          modelbiped.isRiding = this.mainModel.isRiding;
        }

        if (modelbiped != null) {
          modelbiped.isChild = this.mainModel.isChild;
        }

        float f1 = 1.0F;

        if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH) {
          int j = itemarmor.getColor(itemstack);
          float f2 = (float) (j >> 16 & 255) / 255.0F;
          float f3 = (float) (j >> 8 & 255) / 255.0F;
          float f4 = (float) (j & 255) / 255.0F;
          GL11.glColor3f(f1 * f2, f1 * f3, f1 * f4);

          if (itemstack.isItemEnchanted()) {
            return 31;
          }

          return 16;
        }

        GL11.glColor3f(f1, f1, f1);

        if (itemstack.isItemEnchanted()) {
          return 15;
        }

        return 1;
      }
    }

    return -1;
  }
Exemplo n.º 2
0
  /** Set the specified armor model as the player model. Args: player, armorSlot, partialTick */
  @Override
  protected int setArmorModel(EntityPlayer par1EntityPlayer, int par2, float par3) {
    ItemStack itemstack = par1EntityPlayer.inventory.armorItemInSlot(3 - par2);
    RenderPlayerTFC.armorFilenamePrefix = RenderPlayer.armorFilenamePrefix;

    if (itemstack != null) {
      Item item = itemstack.getItem();

      if (item instanceof ItemArmor) {
        ItemArmor itemarmor = (ItemArmor) item;
        this.loadTexture(
            ForgeHooksClient.getArmorTexture(
                itemstack,
                "/armor/"
                    + armorFilenamePrefix[itemarmor.renderIndex]
                    + "_"
                    + (par2 == 2 ? 2 : 1)
                    + ".png"));
        ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate;
        modelbiped.bipedHead.showModel = par2 == 0;
        plume.showModel = false; // (itemstack.getItem() == TFCItems.BronzeHelmet);
        plume2.showModel = false; // (itemstack.getItem() == TFCItems.BronzeHelmet);
        HornR1.showModel = false; // (itemstack.getItem() == TFCItems.WroughtIronHelmet);
        HornL1.showModel = false; // (itemstack.getItem() == TFCItems.WroughtIronHelmet);
        modelbiped.bipedHeadwear.showModel =
            par2 == 0
                && (itemstack.getItem() != TFCItems.BronzeHelmet
                    && itemstack.getItem() != TFCItems.WroughtIronHelmet);
        modelbiped.bipedBody.showModel = par2 == 1 || par2 == 2;
        modelbiped.bipedRightArm.showModel = par2 == 1;
        modelbiped.bipedLeftArm.showModel = par2 == 1;
        modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
        modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
        this.setRenderPassModel(modelbiped);

        if (modelbiped != null) {
          modelbiped.onGround = this.mainModel.onGround;
        }

        if (modelbiped != null) {
          modelbiped.isRiding = this.mainModel.isRiding;
        }

        if (modelbiped != null) {
          modelbiped.isChild = this.mainModel.isChild;
        }

        float f1 = 1.0F;

        if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH) {
          int j = itemarmor.getColor(itemstack);
          float f2 = (j >> 16 & 255) / 255.0F;
          float f3 = (j >> 8 & 255) / 255.0F;
          float f4 = (j & 255) / 255.0F;
          GL11.glColor3f(f1 * f2, f1 * f3, f1 * f4);

          if (itemstack.isItemEnchanted()) {
            return 31;
          }

          return 16;
        }

        GL11.glColor3f(f1, f1, f1);

        if (itemstack.isItemEnchanted()) {
          return 15;
        }

        return 1;
      }
    }

    return -1;
  }