Ejemplo n.º 1
0
 protected JsonerItemArmor(Item item, boolean showRecipes) {
   super(item, 0, showRecipes);
   ItemArmor armor = (ItemArmor) item;
   this.armorType = armor.armorType;
   this.damageReduceAmount = armor.damageReduceAmount;
   this.armorMaterial =
       ReflectionHelper.getPrivateValue(
           ArmorMaterial.class, armor.getArmorMaterial(), "name", "field_179243_f");
 }
Ejemplo n.º 2
0
  @Override
  public void onArmorTick(final World world, final EntityPlayer player, final ItemStack itemStack) {
    super.onArmorTick(world, player, itemStack);
    final ItemStack boots = player.inventory.armorItemInSlot(0);
    final ItemStack pants = player.inventory.armorItemInSlot(1);
    final ItemStack chest = player.inventory.armorItemInSlot(2);
    final ItemStack head = player.inventory.armorItemInSlot(3);

    if (boots != null
        && boots.getItem() == ModItems.bootsPurple
        && pants != null
        && pants.getItem() == ModItems.leggingsPurple
        && chest != null
        && chest.getItem() == ModItems.chestplatePurple
        && head != null
        && head.getItem() == ModItems.helmetPurple)
      player.addPotionEffect(new PotionEffect(Potion.resistance.id, 0, 2));
  }
Ejemplo n.º 3
0
 @SideOnly(Side.CLIENT)
 /** Returns the icon index on items.png that is used as background image of the slot. */
 public IIcon getBackgroundIconIndex() {
   return ItemArmor.func_94602_b(this.armorType);
 }
Ejemplo n.º 4
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;
  }
Ejemplo n.º 5
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;
  }