Java 类net.minecraft.item.ItemArmor 实例源码

项目:EndermanEvolution    文件:ArmorUtils.java   
public static ItemArmor.ArmorMaterial addArmorMaterial(String enumName, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness) {
    return EnumHelper.addEnum(ItemArmor.ArmorMaterial.class, enumName, new Class[] {
            String.class,
            Integer.TYPE,
            int[].class,
            Integer.TYPE,
            SoundEvent.class,
            Float.TYPE
    }, new Object[] {
            textureName,
            Integer.valueOf(durability),
            reductionAmounts,
            Integer.valueOf(enchantability),
            soundOnEquip,
            Float.valueOf(toughness)
    });
}
项目:Loot-Slash-Conquer    文件:EventItemTooltip.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onItemTooltip(ItemTooltipEvent event)
{
    ArrayList<String> tooltip = (ArrayList<String>) event.getToolTip();
    ItemStack stack = event.getItemStack();
    NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);

    if (event.getEntityPlayer() != null)
    {
        PlayerInformation info = (PlayerInformation) event.getEntityPlayer().getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);

        if (info != null && (stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemLEMagical || stack.getItem() instanceof ItemLEBauble))
        {
            Rarity rarity = Rarity.getRarity(nbt);

            if (rarity != Rarity.DEFAULT)
            {
                if (stack.getItem() instanceof ItemSword) drawMelee(tooltip, stack, nbt, event.getEntityPlayer(), info);
                else if (stack.getItem() instanceof ItemArmor) drawArmor(tooltip, stack, nbt, event.getEntityPlayer(), info);
                else if (stack.getItem() instanceof ItemLEMagical) drawMagical(tooltip, stack, nbt, event.getEntityPlayer(), info);
                else if (stack.getItem() instanceof ItemLEBauble) drawBauble(tooltip, stack, nbt, event.getEntityPlayer(), info);
            }
        }
    }
}
项目:DecompiledMinecraft    文件:EntityLivingBase.java   
/**
 * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
 */
public int getTotalArmorValue()
{
    int i = 0;

    for (ItemStack itemstack : this.getInventory())
    {
        if (itemstack != null && itemstack.getItem() instanceof ItemArmor)
        {
            int j = ((ItemArmor)itemstack.getItem()).damageReduceAmount;
            i += j;
        }
    }

    return i;
}
项目:DecompiledMinecraft    文件:InventoryPlayer.java   
/**
 * Based on the damage values and maximum damage values of each armor item, returns the current armor value.
 */
public int getTotalArmorValue()
{
    int i = 0;

    for (int j = 0; j < this.armorInventory.length; ++j)
    {
        if (this.armorInventory[j] != null && this.armorInventory[j].getItem() instanceof ItemArmor)
        {
            int k = ((ItemArmor)this.armorInventory[j].getItem()).damageReduceAmount;
            i += k;
        }
    }

    return i;
}
项目:DecompiledMinecraft    文件:InventoryPlayer.java   
/**
 * Damages armor in each slot by the specified amount.
 */
public void damageArmor(float damage)
{
    damage = damage / 4.0F;

    if (damage < 1.0F)
    {
        damage = 1.0F;
    }

    for (int i = 0; i < this.armorInventory.length; ++i)
    {
        if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ItemArmor)
        {
            this.armorInventory[i].damageItem((int)damage, this.player);

            if (this.armorInventory[i].stackSize == 0)
            {
                this.armorInventory[i] = null;
            }
        }
    }
}
项目:DecompiledMinecraft    文件:EntityLivingBase.java   
/**
 * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
 */
public int getTotalArmorValue()
{
    int i = 0;

    for (ItemStack itemstack : this.getInventory())
    {
        if (itemstack != null && itemstack.getItem() instanceof ItemArmor)
        {
            int j = ((ItemArmor)itemstack.getItem()).damageReduceAmount;
            i += j;
        }
    }

    return i;
}
项目:DecompiledMinecraft    文件:InventoryPlayer.java   
/**
 * Based on the damage values and maximum damage values of each armor item, returns the current armor value.
 */
public int getTotalArmorValue()
{
    int i = 0;

    for (int j = 0; j < this.armorInventory.length; ++j)
    {
        if (this.armorInventory[j] != null && this.armorInventory[j].getItem() instanceof ItemArmor)
        {
            int k = ((ItemArmor)this.armorInventory[j].getItem()).damageReduceAmount;
            i += k;
        }
    }

    return i;
}
项目:DecompiledMinecraft    文件:InventoryPlayer.java   
/**
 * Damages armor in each slot by the specified amount.
 */
public void damageArmor(float damage)
{
    damage = damage / 4.0F;

    if (damage < 1.0F)
    {
        damage = 1.0F;
    }

    for (int i = 0; i < this.armorInventory.length; ++i)
    {
        if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ItemArmor)
        {
            this.armorInventory[i].damageItem((int)damage, this.player);

            if (this.armorInventory[i].stackSize == 0)
            {
                this.armorInventory[i] = null;
            }
        }
    }
}
项目:BaseClient    文件:InventoryPlayer.java   
/**
 * Based on the damage values and maximum damage values of each armor item, returns the current armor value.
 */
public int getTotalArmorValue()
{
    int i = 0;

    for (int j = 0; j < this.armorInventory.length; ++j)
    {
        if (this.armorInventory[j] != null && this.armorInventory[j].getItem() instanceof ItemArmor)
        {
            int k = ((ItemArmor)this.armorInventory[j].getItem()).damageReduceAmount;
            i += k;
        }
    }

    return i;
}
项目:BaseClient    文件:InventoryPlayer.java   
/**
 * Damages armor in each slot by the specified amount.
 */
public void damageArmor(float damage)
{
    damage = damage / 4.0F;

    if (damage < 1.0F)
    {
        damage = 1.0F;
    }

    for (int i = 0; i < this.armorInventory.length; ++i)
    {
        if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ItemArmor)
        {
            this.armorInventory[i].damageItem((int)damage, this.player);

            if (this.armorInventory[i].stackSize == 0)
            {
                this.armorInventory[i] = null;
            }
        }
    }
}
项目:BaseClient    文件:EntityLivingBase.java   
/**
 * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
 */
public int getTotalArmorValue()
{
    int i = 0;

    for (ItemStack itemstack : this.getInventory())
    {
        if (itemstack != null && itemstack.getItem() instanceof ItemArmor)
        {
            int j = ((ItemArmor)itemstack.getItem()).damageReduceAmount;
            i += j;
        }
    }

    return i;
}
项目:BaseClient    文件:InventoryPlayer.java   
/**
 * Based on the damage values and maximum damage values of each armor item, returns the current armor value.
 */
public int getTotalArmorValue()
{
    int i = 0;

    for (int j = 0; j < this.armorInventory.length; ++j)
    {
        if (this.armorInventory[j] != null && this.armorInventory[j].getItem() instanceof ItemArmor)
        {
            int k = ((ItemArmor)this.armorInventory[j].getItem()).damageReduceAmount;
            i += k;
        }
    }

    return i;
}
项目:BaseClient    文件:InventoryPlayer.java   
/**
 * Damages armor in each slot by the specified amount.
 */
public void damageArmor(float damage)
{
    damage = damage / 4.0F;

    if (damage < 1.0F)
    {
        damage = 1.0F;
    }

    for (int i = 0; i < this.armorInventory.length; ++i)
    {
        if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ItemArmor)
        {
            this.armorInventory[i].damageItem((int)damage, this.player);

            if (this.armorInventory[i].stackSize == 0)
            {
                this.armorInventory[i] = null;
            }
        }
    }
}
项目:Backmemed    文件:EntityLivingBase.java   
protected void playEquipSound(ItemStack stack)
{
    if (!stack.func_190926_b())
    {
        SoundEvent soundevent = SoundEvents.ITEM_ARMOR_EQUIP_GENERIC;
        Item item = stack.getItem();

        if (item instanceof ItemArmor)
        {
            soundevent = ((ItemArmor)item).getArmorMaterial().getSoundEvent();
        }
        else if (item == Items.ELYTRA)
        {
            soundevent = SoundEvents.field_191258_p;
        }

        this.playSound(soundevent, 1.0F, 1.0F);
    }
}
项目:Backmemed    文件:InventoryPlayer.java   
/**
 * Damages armor in each slot by the specified amount.
 */
public void damageArmor(float damage)
{
    damage = damage / 4.0F;

    if (damage < 1.0F)
    {
        damage = 1.0F;
    }

    for (int i = 0; i < this.armorInventory.size(); ++i)
    {
        ItemStack itemstack = (ItemStack)this.armorInventory.get(i);

        if (itemstack.getItem() instanceof ItemArmor)
        {
            itemstack.damageItem((int)damage, this.player);
        }
    }
}
项目:CustomWorldGen    文件:ForgeHooks.java   
public static int getTotalArmorValue(EntityPlayer player)
{
    int ret = 0;
    for (int x = 0; x < player.inventory.armorInventory.length; x++)
    {
        ItemStack stack = player.inventory.armorInventory[x];
        if (stack != null && stack.getItem() instanceof ISpecialArmor)
        {
            ret += ((ISpecialArmor)stack.getItem()).getArmorDisplay(player, stack, x);
        }
        else if (stack != null && stack.getItem() instanceof ItemArmor)
        {
            ret += ((ItemArmor)stack.getItem()).damageReduceAmount;
        }
    }
    return ret;
}
项目:CustomWorldGen    文件:EntityLivingBase.java   
protected void playEquipSound(@Nullable ItemStack stack)
{
    if (stack != null)
    {
        SoundEvent soundevent = SoundEvents.ITEM_ARMOR_EQUIP_GENERIC;
        Item item = stack.getItem();

        if (item instanceof ItemArmor)
        {
            soundevent = ((ItemArmor)item).getArmorMaterial().getSoundEvent();
        }
        else if (item == Items.ELYTRA)
        {
            soundevent = SoundEvents.ITEM_ARMOR_EQUIP_LEATHER;
        }

        this.playSound(soundevent, 1.0F, 1.0F);
    }
}
项目:CustomWorldGen    文件:InventoryPlayer.java   
/**
 * Damages armor in each slot by the specified amount.
 */
public void damageArmor(float damage)
{
    damage = damage / 4.0F;

    if (damage < 1.0F)
    {
        damage = 1.0F;
    }

    for (int i = 0; i < this.armorInventory.length; ++i)
    {
        if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ItemArmor)
        {
            this.armorInventory[i].damageItem((int)damage, this.player);

            if (this.armorInventory[i].stackSize == 0)
            {
                this.armorInventory[i] = null;
            }
        }
    }
}
项目:AdvancedCombat    文件:ArmorHandler.java   
/** Get how many pieces of armor of a specified type the entity is wearing */
public static int getWearingSetCount(EntityLivingBase entity, Class<? extends ItemArmor> armorClass) {
    ItemStack HEAD, CHEST, LEGS, FEET;
    HEAD = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    CHEST = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
    LEGS = entity.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
    FEET = entity.getItemStackFromSlot(EntityEquipmentSlot.FEET);
    boolean helm = !HEAD.isEmpty() && armorClass.isInstance(HEAD.getItem());
    boolean chest = !CHEST.isEmpty() && armorClass.isInstance(CHEST.getItem());
    boolean legs = !LEGS.isEmpty() && armorClass.isInstance(LEGS.getItem());
    boolean boots = !FEET.isEmpty() && armorClass.isInstance(FEET.getItem());
    return (helm ? 1 : 0) + (chest ? 1 : 0) + (legs ? 1 : 0) + (boots ? 1 : 0);
}
项目:Lanolin    文件:RecipeLanolinFactory.java   
@Override
@Nonnull
public ItemStack getCraftingResult(InventoryCrafting inv) {
    int lanolinCount = 0;
    ItemStack craftStack = null;
    for(int i = 0; i < inv.getSizeInventory(); i++){
        ItemStack tempStack = inv.getStackInSlot(i);
        if(tempStack.getItem().getRegistryName().equals(ModItems.itemLanolin.getRegistryName()))
            lanolinCount++;
        else if(ItemLanolin.canCraftWith(tempStack) && craftStack == null) {
            craftStack = tempStack.copy();
        }
        else if(tempStack != ItemStack.EMPTY)
            return ItemStack.EMPTY;
    }
    if (craftStack == ItemStack.EMPTY || !ItemLanolin.canCraftWith(craftStack)) {
        return ItemStack.EMPTY;
    }
    // Copy Existing NBT
    if(craftStack.hasTagCompound()) {
        if(craftStack.getTagCompound().hasKey("lanolin")){
            // Increase existing lanolin count
            lanolinCount += craftStack.getTagCompound().getInteger("lanolin");
        }
    }
    if(craftStack.getItem() instanceof ItemArmor)
        craftStack.setTagInfo("lanolin", new NBTTagByte((byte) clamp(lanolinCount,0, Config.MAX_LANOLIN_ARMOR)));
    else if(craftStack.getItem() instanceof ItemTool)
        craftStack.setTagInfo("lanolin", new NBTTagByte((byte) clamp(lanolinCount,0, Config.MAX_LANOLIN_TOOLS)));
    else // Unconfigured item, that passed
        craftStack.setTagInfo("lanolin", new NBTTagByte((byte) clamp(lanolinCount,0, 15)));
    return craftStack;
}
项目:pnc-repressurized    文件:ItemPneumaticArmor.java   
public ItemPneumaticArmor(ItemArmor.ArmorMaterial material, int renderIndex, EntityEquipmentSlot armorType, int maxAir) {
    super(material, renderIndex, armorType);
    // TODO other armor types?
    setRegistryName("pneumatic_helmet");
    setUnlocalizedName("pneumatic_helmet");
    setMaxDamage(maxAir);
    setCreativeTab(PneumaticCraftRepressurized.tabPneumaticCraft);
}
项目:harshencastle    文件:HarshenJaguarArmor.java   
@SideOnly(Side.CLIENT)
@Override
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot,
        ModelBiped _default) {
    if (itemStack != null) {
        if (itemStack.getItem() instanceof ItemArmor) {

            EntityEquipmentSlot type = ((ItemArmor) itemStack.getItem()).armorType;
            ModelArmour armorModel = null;
            switch (type) {
            case HEAD:
            case LEGS:
                armorModel = HarshenCastle.proxy.getArmorModel(0);
                break;
            case FEET:
            case CHEST:
                armorModel =  HarshenCastle.proxy.getArmorModel(1);
                break;
            default:
                break;
            }

            armorModel.slotActive = armorSlot;
            armorModel.isSneak = _default.isSneak;
            armorModel.isRiding = _default.isRiding;
            armorModel.isChild = _default.isChild;
            armorModel.rightArmPose = _default.rightArmPose;
            armorModel.leftArmPose = _default.leftArmPose;
            return armorModel;
        }
    }
    return null;
}
项目:needtobreath    文件:HazmatSuitModel.java   
public static ModelBiped getModel(EntityLivingBase entity, ItemStack stack) {

        if (stack.isEmpty() || !(stack.getItem() instanceof ItemArmor)) {
            return null;
        }
        EntityEquipmentSlot slot = ((ItemArmor) stack.getItem()).armorType;

        HazmatSuitModel armor;
        if (slot == EntityEquipmentSlot.HEAD && modelHelm != null) {
            return modelHelm;
        }

        armor = new HazmatSuitModel();
        armor.bipedBody.isHidden = true;
        armor.bipedLeftArm.isHidden = true;
        armor.bipedRightArm.isHidden = true;

        armor.bipedHead.isHidden = true;

        armor.bipedLeftLeg.isHidden = true;
        armor.bipedRightLeg.isHidden = true;

        switch (slot) {
            case HEAD:
                armor.bipedHead.isHidden = false;
                modelHelm = armor;
                break;
        }
        return armor;
    }
项目:needtobreath    文件:ProtectiveHelmetModel2.java   
public static ModelBiped getModel(EntityLivingBase entity, ItemStack stack) {

        if (stack.isEmpty() || !(stack.getItem() instanceof ItemArmor)) {
            return null;
        }
        EntityEquipmentSlot slot = ((ItemArmor) stack.getItem()).armorType;

        ProtectiveHelmetModel2 armor;
        if (slot == EntityEquipmentSlot.HEAD && modelHelm2 != null) {
            return modelHelm2;
        }

        armor = new ProtectiveHelmetModel2();
        armor.bipedBody.isHidden = true;
        armor.bipedLeftArm.isHidden = true;
        armor.bipedRightArm.isHidden = true;

        armor.bipedHead.isHidden = true;

        armor.bipedLeftLeg.isHidden = true;
        armor.bipedRightLeg.isHidden = true;

        switch (slot) {
            case HEAD:
                armor.bipedHead.isHidden = false;
                modelHelm2 = armor;
                break;
        }
        return armor;
    }
项目:needtobreath    文件:ProtectiveHelmetModel.java   
public static ModelBiped getModel(EntityLivingBase entity, ItemStack stack) {

        if (stack.isEmpty() || !(stack.getItem() instanceof ItemArmor)) {
            return null;
        }
        EntityEquipmentSlot slot = ((ItemArmor) stack.getItem()).armorType;

        ProtectiveHelmetModel armor;
        if (slot == EntityEquipmentSlot.HEAD && modelHelm != null) {
            return modelHelm;
        }

        armor = new ProtectiveHelmetModel();
        armor.bipedBody.isHidden = true;
        armor.bipedLeftArm.isHidden = true;
        armor.bipedRightArm.isHidden = true;

        armor.bipedHead.isHidden = true;

        armor.bipedLeftLeg.isHidden = true;
        armor.bipedRightLeg.isHidden = true;

        switch (slot) {
            case HEAD:
                armor.bipedHead.isHidden = false;
                modelHelm = armor;
                break;
        }
        return armor;
    }
项目:needtobreath    文件:InformationGlassesModel.java   
public static ModelBiped getModel(EntityLivingBase entity, ItemStack stack) {

        if (stack.isEmpty() || !(stack.getItem() instanceof ItemArmor)) {
            return null;
        }
        EntityEquipmentSlot slot = ((ItemArmor) stack.getItem()).armorType;

        InformationGlassesModel armor;
        if (slot == EntityEquipmentSlot.HEAD && modelHelm != null) {
            return modelHelm;
        }

        armor = new InformationGlassesModel();
        armor.bipedBody.isHidden = true;
        armor.bipedLeftArm.isHidden = true;
        armor.bipedRightArm.isHidden = true;

        armor.bipedHead.isHidden = true;

        armor.bipedLeftLeg.isHidden = true;
        armor.bipedRightLeg.isHidden = true;

        switch (slot) {
            case HEAD:
                armor.bipedHead.isHidden = false;
                modelHelm = armor;
                break;
        }
        return armor;
    }
项目:Metalworks    文件:ItemArmorCollection.java   
public ItemArmorCollection(ItemArmor.ArmorMaterial material){
    this.material = material;
    head = new Armor(material, EntityEquipmentSlot.HEAD);
    chestplate = new Armor(material, EntityEquipmentSlot.CHEST);
    legs = new Armor(material, EntityEquipmentSlot.LEGS);
    shoes = new Armor(material, EntityEquipmentSlot.FEET);
}
项目:Randores2    文件:RandoresItemArmor.java   
protected void delegateVoid(RandoresItemData data, Consumer<ItemArmor> action, Runnable def) {
    ItemArmor handler = this.handlers.get(data);
    if (handler != null) {
        action.accept(handler);
    } else {
        def.run();
    }
}
项目:Randores2    文件:RandoresItemArmor.java   
protected void delegateVoid(ItemStack stack, Consumer<ItemArmor> action, Runnable def) {
    if (stack != null) {
        this.delegateVoid(new RandoresItemData(stack), action, def);
    } else {
        def.run();
    }
}
项目:Randores2    文件:RandoresItemArmor.java   
protected <T> T delegate(RandoresItemData data, Function<ItemArmor, T> action, Supplier<T> def) {
    ItemArmor handler = this.handlers.get(data);
    if (handler != null) {
        return action.apply(handler);
    } else {
        return def.get();
    }
}
项目:Randores2    文件:RandoresItemArmor.java   
protected <T> T delegate(ItemStack stack, Function<ItemArmor, T> action, Supplier<T> def) {
    if (stack != null) {
        return this.delegate(new RandoresItemData(stack), action, def);
    } else {
        return def.get();
    }
}
项目:DecompiledMinecraft    文件:EntityLiving.java   
public static int getArmorPosition(ItemStack stack)
{
    if (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull)
    {
        if (stack.getItem() instanceof ItemArmor)
        {
            switch (((ItemArmor)stack.getItem()).armorType)
            {
                case 0:
                    return 4;

                case 1:
                    return 3;

                case 2:
                    return 2;

                case 3:
                    return 1;
            }
        }

        return 0;
    }
    else
    {
        return 4;
    }
}
项目:DecompiledMinecraft    文件:RecipesArmorDyes.java   
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.dye)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
项目:DecompiledMinecraft    文件:EntityLiving.java   
public static int getArmorPosition(ItemStack stack)
{
    if (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull)
    {
        if (stack.getItem() instanceof ItemArmor)
        {
            switch (((ItemArmor)stack.getItem()).armorType)
            {
                case 0:
                    return 4;

                case 1:
                    return 3;

                case 2:
                    return 2;

                case 3:
                    return 1;
            }
        }

        return 0;
    }
    else
    {
        return 4;
    }
}
项目:DecompiledMinecraft    文件:RecipesArmorDyes.java   
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.dye)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
项目:DecompiledMinecraft    文件:LayerArmorBase.java   
private void renderLayer(EntityLivingBase entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float p_177182_4_, float p_177182_5_, float p_177182_6_, float p_177182_7_, float p_177182_8_, int armorSlot)
{
    ItemStack itemstack = this.getCurrentArmor(entitylivingbaseIn, armorSlot);

    if (itemstack != null && itemstack.getItem() instanceof ItemArmor)
    {
        ItemArmor itemarmor = (ItemArmor)itemstack.getItem();
        T t = this.func_177175_a(armorSlot);
        t.setModelAttributes(this.renderer.getMainModel());
        t.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_4_);
        this.func_177179_a(t, armorSlot);
        boolean flag = this.isSlotForLeggings(armorSlot);
        this.renderer.bindTexture(this.getArmorResource(itemarmor, flag));

        switch (itemarmor.getArmorMaterial())
        {
            case LEATHER:
                int i = itemarmor.getColor(itemstack);
                float f = (float)(i >> 16 & 255) / 255.0F;
                float f1 = (float)(i >> 8 & 255) / 255.0F;
                float f2 = (float)(i & 255) / 255.0F;
                GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha);
                t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);
                this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay"));

            case CHAIN:
            case IRON:
            case GOLD:
            case DIAMOND:
                GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha);
                t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);

            default:
                if (!this.field_177193_i && itemstack.isItemEnchanted())
                {
                    this.func_177183_a(entitylivingbaseIn, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);
                }
        }
    }
}
项目:CustomWorldGen    文件:RecipesArmorDyes.java   
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.DYE)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
项目:BaseClient    文件:EntityLiving.java   
public static int getArmorPosition(ItemStack stack)
{
    if (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull)
    {
        if (stack.getItem() instanceof ItemArmor)
        {
            switch (((ItemArmor)stack.getItem()).armorType)
            {
                case 0:
                    return 4;

                case 1:
                    return 3;

                case 2:
                    return 2;

                case 3:
                    return 1;
            }
        }

        return 0;
    }
    else
    {
        return 4;
    }
}
项目:BaseClient    文件:RecipesArmorDyes.java   
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.dye)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
项目:BaseClient    文件:LayerArmorBase.java   
private void renderLayer(EntityLivingBase entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float p_177182_4_, float p_177182_5_, float p_177182_6_, float p_177182_7_, float p_177182_8_, int armorSlot)
{
    ItemStack itemstack = this.getCurrentArmor(entitylivingbaseIn, armorSlot);

    if (itemstack != null && itemstack.getItem() instanceof ItemArmor)
    {
        ItemArmor itemarmor = (ItemArmor)itemstack.getItem();
        T t = this.func_177175_a(armorSlot);
        t.setModelAttributes(this.renderer.getMainModel());
        t.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_4_);
        this.func_177179_a(t, armorSlot);
        boolean flag = this.isSlotForLeggings(armorSlot);
        this.renderer.bindTexture(this.getArmorResource(itemarmor, flag));

        switch (itemarmor.getArmorMaterial())
        {
            case LEATHER:
                int i = itemarmor.getColor(itemstack);
                float f = (float)(i >> 16 & 255) / 255.0F;
                float f1 = (float)(i >> 8 & 255) / 255.0F;
                float f2 = (float)(i & 255) / 255.0F;
                GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha);
                t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);
                this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay"));

            case CHAIN:
            case IRON:
            case GOLD:
            case DIAMOND:
                GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha);
                t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);

            default:
                if (!this.field_177193_i && itemstack.isItemEnchanted())
                {
                    this.func_177183_a(entitylivingbaseIn, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);
                }
        }
    }
}