當前位置: 首頁>>代碼示例>>Java>>正文


Java ISpecialArmor類代碼示例

本文整理匯總了Java中net.minecraftforge.common.ISpecialArmor的典型用法代碼示例。如果您正苦於以下問題:Java ISpecialArmor類的具體用法?Java ISpecialArmor怎麽用?Java ISpecialArmor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ISpecialArmor類屬於net.minecraftforge.common包,在下文中一共展示了ISpecialArmor類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getArmorPoints

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
/** @return The points gained from a single item in the player's armor
 * @see ForgeHooks#getTotalArmorValue() */
private static int getArmorPoints(EntityPlayer player, int slot) {
	ItemStack stack = player.inventory.armorItemInSlot(slot);

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

		// Allow for custom calculations
		if(item instanceof ISpecialArmor) {
			return ((ISpecialArmor)item).getArmorDisplay(player, stack, slot);
		} else if(item instanceof ItemArmor) {
			return ((ItemArmor)item).damageReduceAmount;
		}
	}
	return 0;
}
 
開發者ID:mccreery,項目名稱:armor-chroma,代碼行數:18,代碼來源:GuiArmor.java

示例2: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
	if (source.isUnblockable()) {
		return new ISpecialArmor.ArmorProperties(0, 0.0D, 0);
	}
	double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio();
	int damageLimit = (int) (25 * itemManager.getEnergy(armor) / getEnergyPerDamage());
	return new ISpecialArmor.ArmorProperties(0, absorptionRatio, damageLimit);
}
 
開發者ID:Kanbe-Kotori,項目名稱:ExtraAcC,代碼行數:10,代碼來源:ItemImagEnergyArmor.java

示例3: damageEntity

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
protected void damageEntity(DamageSource p_70665_1_, float p_70665_2_)
{
	if (!isEntityInvulnerable())
	{
		p_70665_2_ = ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
		if (p_70665_2_ <= 0.0F) {
			return;
		}
		if ((!p_70665_1_.isUnblockable()) && (isBlocking()) && (p_70665_2_ > 0.0F)) {
			p_70665_2_ = (1.0F + p_70665_2_) * 0.5F;
		}
		p_70665_2_ = ISpecialArmor.ArmorProperties.ApplyArmor(this, this.inventory.armorInventory, p_70665_1_, p_70665_2_);
		if (p_70665_2_ <= 0.0F) {
			return;
		}
		p_70665_2_ = applyPotionDamageCalculations(p_70665_1_, p_70665_2_);
		float f1 = p_70665_2_;
		p_70665_2_ = Math.max(p_70665_2_ - getAbsorptionAmount(), 0.0F);
		setAbsorptionAmount(getAbsorptionAmount() - (f1 - p_70665_2_));
		if (p_70665_2_ != 0.0F)
		{
			addExhaustion(p_70665_1_.getHungerDamage());
			float f2 = getHealth();
			setHealth(getHealth() - p_70665_2_);
			func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
		}
	}
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:29,代碼來源:EntityPlayer.java

示例4: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
    if (source.isUnblockable()) {
        return new ISpecialArmor.ArmorProperties(0, 0.0D, 0);
    }
    double absorptionRatio = this.baseAbsorptionRatio * this.damageAbsorptionRatio;

    int damageLimit = Integer.MAX_VALUE;
    if (this.energyPerDamage > 0) {
        damageLimit = (int)Math.min(damageLimit, 25.0D * ElectricItem.manager.getCharge(armor) / this.energyPerDamage);
    }
    return new ISpecialArmor.ArmorProperties(0, absorptionRatio, damageLimit);
}
 
開發者ID:estebes,項目名稱:Gravitation-Suite-Reloaded,代碼行數:14,代碼來源:ItemElectricArmor.java

示例5: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
    if (source.isUnblockable()) {
        return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 0);
    } else {
        double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio();
        int energyPerDamage = getEnergyPerDamage();
        double damageLimit = energyPerDamage <= 0 ? 0 : (25 * ElectricItem.manager.getCharge(armor)) / energyPerDamage;
        return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, absorptionRatio, (int) damageLimit);
    }
}
 
開發者ID:TeamAmeriFrance,項目名稱:Electro-Magic-Tools,代碼行數:12,代碼來源:ItemElectricGoggles.java

示例6: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
    if (source.isUnblockable()) {
        return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 3);
    } else {
        double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio();
        int energyPerDamage = getEnergyPerDamage();
        double damageLimit = energyPerDamage <= 0 ? 0 : (25 * ElectricItem.manager.getCharge(armor)) / energyPerDamage;
        return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(3, absorptionRatio, (int) damageLimit);
    }
}
 
開發者ID:TeamAmeriFrance,項目名稱:Electro-Magic-Tools,代碼行數:12,代碼來源:ItemNanoWing.java

示例7: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
/**
 * Inherited from ISpecialArmor, allows significant customization of damage
 * calculations.
 */
@Override
public ISpecialArmor.ArmorProperties getProperties(EntityLiving player, ItemStack armor, DamageSource source, double damage, int slot) {
	// Order in which this armor is assessed for damage. Higher(?) priority
	// items take damage first, and if none spills over, the other items
	// take no damage.
	int priority = 1;
	double armorDouble;

	if (player instanceof EntityPlayer) {
		armorDouble = getArmorDouble((EntityPlayer) player, armor);
	} else {
		armorDouble = 2;
	}

	// How much of incoming damage is absorbed by this armor piece.
	// 1.0 = absorbs all damage
	// 0.5 = 50% damage to item, 50% damage carried over
	double absorbRatio = 0.04 * armorDouble;

	// Maximum damage absorbed by this piece. Actual damage to this item
	// will be clamped between (damage * absorbRatio) and (absorbMax). Note
	// that a player has 20 hp (1hp = 1 half-heart)
	int absorbMax = (int) armorDouble * 75; // Not sure why this is
	// necessary but oh well
	if (source.isUnblockable()) {
		absorbMax = 0;
		absorbRatio = 0;
	}
	return new ArmorProperties(priority, absorbRatio, absorbMax);
}
 
開發者ID:Pumuckl007,項目名稱:WeaponsMod,代碼行數:35,代碼來源:ItemInfoHelmet.java

示例8: handleArmorProtection

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
public static float handleArmorProtection(EntityPlayer player, DamageSource source, float amount, ItemStack armor, BodyPart damaged, EntityEquipmentSlot slotDamaged)
{
	if (source.isUnblockable())
	{
		return amount;
	}
	
	Item armorItem = armor.getItem();
	if (armorItem instanceof ISpecialArmor)
	{
		ISpecialArmor specialArmor = (ISpecialArmor) armorItem;
		float value = ArmorProperties.applyArmor(player, NonNullList.withSize(1, armor), source, amount);
		specialArmor.damageArmor(player, armor, source, (int) amount / 2, slotDamaged.getSlotIndex());
		return value;
	}
	else
	{
		Multimap<String, AttributeModifier> modifiers = armor.getAttributeModifiers(slotDamaged);
		float toughnessMod = 1;
		for (AttributeModifier mod : modifiers.get(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName()))
		{
			if (mod.getOperation() == 0)
			{
				toughnessMod += mod.getAmount();
			}
			else
			{
				toughnessMod *= mod.getAmount();
			}
		}

		if (player instanceof EntityPlayerMP)
		{
			if (armor.attemptDamageItem((int) (amount / 2), player.world.rand, (EntityPlayerMP) player))
			{
				armor.setCount(0);
			}
		}
		
		return amount * (1 / toughnessMod);
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:43,代碼來源:PlayerManager.java

示例9: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLivingBase l, ItemStack s, DamageSource d, double amount, int slot) {
	return new ISpecialArmor.ArmorProperties(0, damageReduction, 50000);
}
 
開發者ID:wolfboyft,項目名稱:Better-Mushroom-Islands,代碼行數:5,代碼來源:Armours.java

示例10: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot)
{
    return new ArmorProperties(0,0,0);
}
 
開發者ID:Arouka,項目名稱:Clothier,代碼行數:6,代碼來源:ArmorGoldArmor.java

示例11: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLivingBase player,
		ItemStack armor, DamageSource source, double damage, int slot) {
	return new ISpecialArmor.ArmorProperties(0, damageReduction / 100,
			50000);
}
 
開發者ID:Eternaldoom,項目名稱:Realms-of-Chaos,代碼行數:7,代碼來源:ItemROCArmor.java

示例12: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLiving player, ItemStack armor,
        DamageSource source, double damage, int slot) {
    // if(true)//shield activated
    // {

    ShieldAtributes atr = new ShieldAtributes(armor);
    int prevCharge = atr.charge;
    if (atr.charge > 0) {
        atr.hitTicker = 20;
    }
    if (atr.charge > 0)// can take more of the damage
    {
        // use energy for one damage
        // atr.charge = atr.charge - 10;
        if (armor.getItemDamage() == 4) {
            float g = (float) Math.random() * 100;

            if (g < 5) {

            } else {
                getHit(atr, damage);
            }
        } else {
            getHit(atr, damage);
        }
    }
    atr.rechargeTicker = atr.rechargeDelay;

    // got hit

    // getHit(armor);

    atr.save(armor);
    if (prevCharge > 0)
        return new ISpecialArmor.ArmorProperties(10, atr.absorbed / damage,
                Integer.MAX_VALUE);
    else
        return new ISpecialArmor.ArmorProperties(0,
                getBaseAbsorptionRatio(), 0);
}
 
開發者ID:lombax5832,項目名稱:BL2,代碼行數:42,代碼來源:ItemArmorShield.java

示例13: getProperties

import net.minecraftforge.common.ISpecialArmor; //導入依賴的package包/類
@Override
public ArmorProperties getProperties(EntityLiving var1, ItemStack var2, DamageSource var3, double var4, int var6)
{
    return new ISpecialArmor.ArmorProperties(0, 0.2D, 50000);
}
 
開發者ID:Hologuardian,項目名稱:FallingEarth,代碼行數:6,代碼來源:ItemMeteoriticArmor.java


注:本文中的net.minecraftforge.common.ISpecialArmor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。