當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。