当前位置: 首页>>代码示例>>Java>>正文


Java ItemArmor类代码示例

本文整理汇总了Java中net.minecraft.item.ItemArmor的典型用法代码示例。如果您正苦于以下问题:Java ItemArmor类的具体用法?Java ItemArmor怎么用?Java ItemArmor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ItemArmor类属于net.minecraft.item包,在下文中一共展示了ItemArmor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addArmorMaterial

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
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)
	});
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:18,代码来源:ArmorUtils.java

示例2: onItemTooltip

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
@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);
			}
		}
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:26,代码来源:EventItemTooltip.java

示例3: getTotalArmorValue

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:EntityLivingBase.java

示例4: getTotalArmorValue

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:InventoryPlayer.java

示例5: damageArmor

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
/**
 * 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;
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:InventoryPlayer.java

示例6: playEquipSound

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:EntityLivingBase.java

示例7: damageArmor

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
/**
 * 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);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:InventoryPlayer.java

示例8: getTotalArmorValue

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:ForgeHooks.java

示例9: playEquipSound

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:EntityLivingBase.java

示例10: getWearingSetCount

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
/** 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);
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:14,代码来源:ArmorHandler.java

示例11: getCraftingResult

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
@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;
}
 
开发者ID:SirLyle,项目名称:Lanolin,代码行数:34,代码来源:RecipeLanolinFactory.java

示例12: ItemPneumaticArmor

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
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);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:ItemPneumaticArmor.java

示例13: getArmorModel

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
@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;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:34,代码来源:HarshenJaguarArmor.java

示例14: getModel

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
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;
    }
 
开发者ID:McJty,项目名称:needtobreath,代码行数:31,代码来源:HazmatSuitModel.java

示例15: getModel

import net.minecraft.item.ItemArmor; //导入依赖的package包/类
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;
    }
 
开发者ID:McJty,项目名称:needtobreath,代码行数:31,代码来源:ProtectiveHelmetModel2.java


注:本文中的net.minecraft.item.ItemArmor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。