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


Java ForgeHooks.onLivingHurt方法代码示例

本文整理汇总了Java中net.minecraftforge.common.ForgeHooks.onLivingHurt方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeHooks.onLivingHurt方法的具体用法?Java ForgeHooks.onLivingHurt怎么用?Java ForgeHooks.onLivingHurt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.ForgeHooks的用法示例。


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

示例1: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的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;
		}
		p_70665_2_ = applyArmorCalculations(p_70665_1_, p_70665_2_);
		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) {
			float f2 = getHealth();
			setHealth(f2 - p_70665_2_);
			func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
			setAbsorptionAmount(getAbsorptionAmount() - p_70665_2_);
		}
	}
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:23,代码来源:EntityLivingBase.java

示例2: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
protected void damageEntity(DamageSource damageSource, float amount)
{
	amount = ForgeHooks.onLivingHurt(this, damageSource, amount);

	if(amount <= 0)
	{
		return;
	}

	amount = applyArmorCalculations(damageSource, amount);
	amount = applyPotionDamageCalculations(damageSource, amount);
	float j = getHealth();

	setEnergy(Math.max(0, getEnergy() - (amount*1000)));
	func_110142_aN().func_94547_a(damageSource, j, amount);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:18,代码来源:EntityRobit.java

示例3: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
protected void damageEntity(DamageSource p_70665_1_, float p_70665_2_)
{
    if (!this.isEntityInvulnerable())
    {
        p_70665_2_ = ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
        if (p_70665_2_ <= 0) return;
        p_70665_2_ = this.applyArmorCalculations(p_70665_1_, p_70665_2_);
        p_70665_2_ = this.applyPotionDamageCalculations(p_70665_1_, p_70665_2_);
        float f1 = p_70665_2_;
        p_70665_2_ = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F);
        this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - p_70665_2_));

        if (p_70665_2_ != 0.0F)
        {
            float f2 = this.getHealth();
            this.setHealth(f2 - p_70665_2_);
            this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
            this.setAbsorptionAmount(this.getAbsorptionAmount() - p_70665_2_);
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:22,代码来源:EntityLivingBase.java

示例4: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
/**
 * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health
 * second with the reduced value. Args: damageAmount
 */
protected void damageEntity(DamageSource par1DamageSource, float par2)
{
    if (!this.isEntityInvulnerable())
    {
        par2 = ForgeHooks.onLivingHurt(this, par1DamageSource, par2);
        if (par2 <= 0) return;
        par2 = this.applyArmorCalculations(par1DamageSource, par2);
        par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
        float f1 = par2;
        par2 = Math.max(par2 - this.getAbsorptionAmount(), 0.0F);
        this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - par2));

        if (par2 != 0.0F)
        {
            float f2 = this.getHealth();
            this.setHealth(f2 - par2);
            this.func_110142_aN().func_94547_a(par1DamageSource, f2, par2);
            this.setAbsorptionAmount(this.getAbsorptionAmount() - par2);
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:26,代码来源:EntityLivingBase.java

示例5: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的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

示例6: damageEntity_CB

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
protected boolean damageEntity_CB(DamageSource p_70665_1_, float p_70665_2_) // void -> boolean
{
    if (true) 
    {
        return super.damageEntity_CB(p_70665_1_, p_70665_2_);
    }
    // CraftBukkit end
    if (!this.isEntityInvulnerable())
    {
        p_70665_2_ = ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
        if (p_70665_2_ <= 0) return false;
        if (!p_70665_1_.isUnblockable() && this.isBlocking() && p_70665_2_ > 0.0F)
        {
            p_70665_2_ = (1.0F + p_70665_2_) * 0.5F;
        }

        p_70665_2_ = ArmorProperties.ApplyArmor(this, inventory.armorInventory, p_70665_1_, p_70665_2_);
        if (p_70665_2_ <= 0) return false;
        p_70665_2_ = this.applyPotionDamageCalculations(p_70665_1_, p_70665_2_);
        float f1 = p_70665_2_;
        p_70665_2_ = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F);
        this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - p_70665_2_));

        if (p_70665_2_ != 0.0F)
        {
            this.addExhaustion(p_70665_1_.getHungerDamage());
            float f2 = this.getHealth();
            this.setHealth(this.getHealth() - p_70665_2_);
            this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
        }
    }
    return false;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:34,代码来源:EntityPlayer.java

示例7: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
protected void damageEntity(DamageSource p_70665_1_, float p_70665_2_)
{
    if (!this.isEntityInvulnerable())
    {
        p_70665_2_ = ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
        if (p_70665_2_ <= 0) return;
        if (!p_70665_1_.isUnblockable() && this.isBlocking() && p_70665_2_ > 0.0F)
        {
            p_70665_2_ = (1.0F + p_70665_2_) * 0.5F;
        }

        p_70665_2_ = ArmorProperties.ApplyArmor(this, inventory.armorInventory, p_70665_1_, p_70665_2_);
        if (p_70665_2_ <= 0) return;
        p_70665_2_ = this.applyPotionDamageCalculations(p_70665_1_, p_70665_2_);
        float f1 = p_70665_2_;
        p_70665_2_ = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F);
        this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - p_70665_2_));

        if (p_70665_2_ != 0.0F)
        {
            this.addExhaustion(p_70665_1_.getHungerDamage());
            float f2 = this.getHealth();
            this.setHealth(this.getHealth() - p_70665_2_);
            this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:28,代码来源:EntityPlayer.java

示例8: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
/**
 * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health
 * second with the reduced value. Args: damageAmount
 */
protected void damageEntity(DamageSource par1DamageSource, float par2)
{
    if (!this.isEntityInvulnerable())
    {
        par2 = ForgeHooks.onLivingHurt(this, par1DamageSource, par2);
        if (par2 <= 0) return;
        if (!par1DamageSource.isUnblockable() && this.isBlocking() && par2 > 0.0F)
        {
            par2 = (1.0F + par2) * 0.5F;
        }

        par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2);
        if (par2 <= 0) return;
        par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
        float f1 = par2;
        par2 = Math.max(par2 - this.getAbsorptionAmount(), 0.0F);
        this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - par2));

        if (par2 != 0.0F)
        {
            this.addExhaustion(par1DamageSource.getHungerDamage());
            float f2 = this.getHealth();
            this.setHealth(this.getHealth() - par2);
            this.func_110142_aN().func_94547_a(par1DamageSource, f2, par2);
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:32,代码来源:EntityPlayer.java

示例9: damageEntity

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
protected void damageEntity(DamageSource dmgSource, float dmg)
   {
	if (this.isEntityInvulnerable()) { return; }	// Nothing to be done here
       
       dmg = ForgeHooks.onLivingHurt(this, dmgSource, dmg);
       if (dmg <= 0) return;
       
       dmg = this.applyArmorCalculations(dmgSource, dmg);
       dmg = this.applyPotionDamageCalculations(dmgSource, dmg);
       
       if (this.hasHeavyPlatingUpgrade)
       {
       	if (!dmgSource.isUnblockable()) { dmg -= this.armorPlatingDmgReduction; }		// If it can be blocked we can defend against it
       	else if (dmgSource.isFireDamage()) { dmg -= this.armorPlatingDmgReduction; }	// Fire is usually unblockable, hm?
       }
       
       if (dmgSource.getDamageType().equals("inWall")) { dmg = 0; }		// Not suffocating in a wall
   	else if (dmgSource.getDamageType().equals("starve")) { dmg = 0; }	// Don't need to eat
       
       if (dmg <= 0) return;
       
       // Damage absorption, if we have it
       float tempDmg = dmg;
       dmg = Math.max(dmg - this.getAbsorptionAmount(), 0.0F);
       this.setAbsorptionAmount(this.getAbsorptionAmount() - (tempDmg - dmg));

       if (dmg != 0.0F)
       {
           float health = this.getHealth();
           this.setHealth(health - dmg);
           this.func_110142_aN().func_94547_a(dmgSource, health, dmg);
           this.setAbsorptionAmount(this.getAbsorptionAmount() - dmg);
       }
       // else, damage is 0. Nothing to be done here
       
       if (!this.worldObj.isRemote && this.getHealth() < this.getMaxHealth() / 3)
       {
       	// Has less than a third health left
       	if (this.hasCommunicationUpgrade && AI_Targeting.isNameOnWhitelist(this, Commands.cmdTellHealth))
       	{
       		AI_Communication.tellOwnerAboutHealth(this);
       	}
       }
   }
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:46,代码来源:Entity_AA.java


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