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


Java EntityLivingBase.heal方法代码示例

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


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

示例1: affectEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void affectEntity(Entity p_180793_1_, Entity p_180793_2_, EntityLivingBase entityLivingBaseIn, int p_180793_4_, double p_180793_5_)
{
    if ((this.id != heal.id || entityLivingBaseIn.isEntityUndead()) && (this.id != harm.id || !entityLivingBaseIn.isEntityUndead()))
    {
        if (this.id == harm.id && !entityLivingBaseIn.isEntityUndead() || this.id == heal.id && entityLivingBaseIn.isEntityUndead())
        {
            int j = (int)(p_180793_5_ * (double)(6 << p_180793_4_) + 0.5D);

            if (p_180793_1_ == null)
            {
                entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)j);
            }
            else
            {
                entityLivingBaseIn.attackEntityFrom(DamageSource.causeIndirectMagicDamage(p_180793_1_, p_180793_2_), (float)j);
            }
        }
    }
    else
    {
        int i = (int)(p_180793_5_ * (double)(4 << p_180793_4_) + 0.5D);
        entityLivingBaseIn.heal((float)i);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:Potion.java

示例2: affectEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void affectEntity(@Nullable Entity source, @Nullable Entity indirectSource, EntityLivingBase entityLivingBaseIn, int amplifier, double health)
{
    if ((this != MobEffects.INSTANT_HEALTH || entityLivingBaseIn.isEntityUndead()) && (this != MobEffects.INSTANT_DAMAGE || !entityLivingBaseIn.isEntityUndead()))
    {
        if (this == MobEffects.INSTANT_DAMAGE && !entityLivingBaseIn.isEntityUndead() || this == MobEffects.INSTANT_HEALTH && entityLivingBaseIn.isEntityUndead())
        {
            int j = (int)(health * (double)(6 << amplifier) + 0.5D);

            if (source == null)
            {
                entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)j);
            }
            else
            {
                entityLivingBaseIn.attackEntityFrom(DamageSource.causeIndirectMagicDamage(source, indirectSource), (float)j);
            }
        }
    }
    else
    {
        int i = (int)(health * (double)(4 << amplifier) + 0.5D);
        entityLivingBaseIn.heal((float)i);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:Potion.java

示例3: performEffect

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void performEffect(EntityLivingBase entity, int amplifier){
    if(TrustCircle.baseRegen > 0){
        if(entity.getHealth() < entity.getMaxHealth()){
            entity.heal(TrustCircle.baseRegen);
        }
    }
}
 
开发者ID:Ellpeck,项目名称:TrustCircle,代码行数:9,代码来源:PotionTrust.java

示例4: performEffect

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_)
{
    if (this.id == regeneration.id)
    {
        if (entityLivingBaseIn.getHealth() < entityLivingBaseIn.getMaxHealth())
        {
            entityLivingBaseIn.heal(1.0F);
        }
    }
    else if (this.id == poison.id)
    {
        if (entityLivingBaseIn.getHealth() > 1.0F)
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, 1.0F);
        }
    }
    else if (this.id == wither.id)
    {
        entityLivingBaseIn.attackEntityFrom(DamageSource.wither, 1.0F);
    }
    else if (this.id == hunger.id && entityLivingBaseIn instanceof EntityPlayer)
    {
        ((EntityPlayer)entityLivingBaseIn).addExhaustion(0.025F * (float)(p_76394_2_ + 1));
    }
    else if (this.id == saturation.id && entityLivingBaseIn instanceof EntityPlayer)
    {
        if (!entityLivingBaseIn.worldObj.isRemote)
        {
            ((EntityPlayer)entityLivingBaseIn).getFoodStats().addStats(p_76394_2_ + 1, 1.0F);
        }
    }
    else if ((this.id != heal.id || entityLivingBaseIn.isEntityUndead()) && (this.id != harm.id || !entityLivingBaseIn.isEntityUndead()))
    {
        if (this.id == harm.id && !entityLivingBaseIn.isEntityUndead() || this.id == heal.id && entityLivingBaseIn.isEntityUndead())
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)(6 << p_76394_2_));
        }
    }
    else
    {
        entityLivingBaseIn.heal((float)Math.max(4 << p_76394_2_, 0));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:44,代码来源:Potion.java

示例5: performEffect

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_)
{
    if (this == MobEffects.REGENERATION)
    {
        if (entityLivingBaseIn.getHealth() < entityLivingBaseIn.getMaxHealth())
        {
            entityLivingBaseIn.heal(1.0F);
        }
    }
    else if (this == MobEffects.POISON)
    {
        if (entityLivingBaseIn.getHealth() > 1.0F)
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, 1.0F);
        }
    }
    else if (this == MobEffects.WITHER)
    {
        entityLivingBaseIn.attackEntityFrom(DamageSource.wither, 1.0F);
    }
    else if (this == MobEffects.HUNGER && entityLivingBaseIn instanceof EntityPlayer)
    {
        ((EntityPlayer)entityLivingBaseIn).addExhaustion(0.005F * (float)(p_76394_2_ + 1));
    }
    else if (this == MobEffects.SATURATION && entityLivingBaseIn instanceof EntityPlayer)
    {
        if (!entityLivingBaseIn.world.isRemote)
        {
            ((EntityPlayer)entityLivingBaseIn).getFoodStats().addStats(p_76394_2_ + 1, 1.0F);
        }
    }
    else if ((this != MobEffects.INSTANT_HEALTH || entityLivingBaseIn.isEntityUndead()) && (this != MobEffects.INSTANT_DAMAGE || !entityLivingBaseIn.isEntityUndead()))
    {
        if (this == MobEffects.INSTANT_DAMAGE && !entityLivingBaseIn.isEntityUndead() || this == MobEffects.INSTANT_HEALTH && entityLivingBaseIn.isEntityUndead())
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)(6 << p_76394_2_));
        }
    }
    else
    {
        entityLivingBaseIn.heal((float)Math.max(4 << p_76394_2_, 0));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:44,代码来源:Potion.java

示例6: onDealDamage

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void onDealDamage(ItemStack stack, EntityLivingBase attacker, Entity target, DamageSource source, float amount) {
	if (TF2Attribute.getModifier("Burn Hit", stack, 0, attacker) > 0)
		TF2Util.igniteAndAchievement(target, attacker, (int) TF2Attribute.getModifier("Burn Time", stack,
				TF2Attribute.getModifier("Burn Hit", stack, 0, attacker), attacker) + 1);
	if (target instanceof EntityLivingBase && attacker.hasCapability(TF2weapons.WEAPONS_CAP, null)){
		boolean enemy = TF2Util.isEnemy(attacker, (EntityLivingBase) target);
		/*if (attacker instanceof EntityPlayerMP && !target.isEntityAlive() && 
		if (attacker instanceof EntityPlayerMP && target instanceof EntitySniper && !target.isEntityAlive() && 
				&& TF2weapons.isEnemy(attacker, (EntityLivingBase) target)){
				*/
		float metalhit = TF2Attribute.getModifier("Metal Hit", stack, 0, attacker);
		if (metalhit != 0) {
			int restore=(int) (amount*metalhit/TF2ConfigVars.damageMultiplier);
			if(!enemy && restore > 30)
				restore=30;
			attacker.getCapability(TF2weapons.WEAPONS_CAP, null).setMetal((int) (attacker.getCapability(TF2weapons.WEAPONS_CAP, null).getMetal()+restore));
		}
		if (!target.isEntityAlive() && !(target instanceof EntityBuilding)
				&& TF2Attribute.getModifier("Kill Count", stack, 0, attacker)!=0){
			stack.getTagCompound().setInteger("Heads", stack.getTagCompound().getInteger("Heads")+1);
		}
		float healthHit=TF2Attribute.getModifier("Health Hit", stack, 0, attacker);
		if (healthHit > 0)
			attacker.heal(enemy ? healthHit : healthHit/2f);
		float bleed=TF2Attribute.getModifier("Bleed", stack, 0, attacker);
		if (bleed > 0) {
			((EntityLivingBase) target).addPotionEffect(new PotionEffect(TF2weapons.bleeding,(int) (bleed*20f)+10,0));
		}
		int rage = (int) TF2Attribute.getModifier("Knockback Rage", stack, 0, attacker);
		if (enemy && !WeaponsCapability.get(attacker).knockbackActive && rage > 0) {
			WeaponsCapability.get(attacker).setKnockbackRage(Math.min(1, WeaponsCapability.get(attacker).getKnockbackRage()+amount*(0.025f+rage*0.017f)));
		}
		if (enemy && TF2Attribute.getModifier("Uber Hit", stack, 0, attacker) > 0)
			if (attacker instanceof EntityPlayer)
				for (ItemStack medigun : ((EntityPlayer) attacker).inventory.mainInventory)
					if (medigun != null && medigun.getItem() instanceof ItemMedigun) {
						medigun.getTagCompound().setFloat("ubercharge",
								MathHelper.clamp(
										medigun.getTagCompound().getFloat("ubercharge")
												+ TF2Attribute.getModifier("Uber Hit", stack, 0, attacker) / 100,
										0, 1));
						if (stack.getTagCompound().getFloat("ubercharge") >= 1)
							attacker.playSound(ItemFromData.getSound(stack, PropertyType.CHARGED_SOUND), 1.2f, 1);
						break;
					}
		if (TF2Attribute.getModifier("Fire Rate Hit", stack, 1, attacker) != 1) {
			//System.out.println(this.getFiringSpeed(stack, attacker) * (1-(1/TF2Attribute.getModifier("Fire Rate Hit", stack, 1, attacker))));
			attacker.getCapability(TF2weapons.WEAPONS_CAP, null).fire1Cool-= this.getFiringSpeed(stack, attacker) * (1-(1/TF2Attribute.getModifier("Fire Rate Hit", stack, 1, attacker)));
			if(attacker instanceof EntityPlayerMP)
				TF2weapons.network.sendTo(new TF2Message.ActionMessage(27,attacker), (EntityPlayerMP) attacker);
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:54,代码来源:ItemWeapon.java

示例7: performEffect

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_)
{
    if (this == MobEffects.REGENERATION)
    {
        if (entityLivingBaseIn.getHealth() < entityLivingBaseIn.getMaxHealth())
        {
            entityLivingBaseIn.heal(1.0F);
        }
    }
    else if (this == MobEffects.POISON)
    {
        if (entityLivingBaseIn.getHealth() > 1.0F)
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, 1.0F);
        }
    }
    else if (this == MobEffects.WITHER)
    {
        entityLivingBaseIn.attackEntityFrom(DamageSource.wither, 1.0F);
    }
    else if (this == MobEffects.HUNGER && entityLivingBaseIn instanceof EntityPlayer)
    {
        ((EntityPlayer)entityLivingBaseIn).addExhaustion(0.025F * (float)(p_76394_2_ + 1));
    }
    else if (this == MobEffects.SATURATION && entityLivingBaseIn instanceof EntityPlayer)
    {
        if (!entityLivingBaseIn.worldObj.isRemote)
        {
            ((EntityPlayer)entityLivingBaseIn).getFoodStats().addStats(p_76394_2_ + 1, 1.0F);
        }
    }
    else if ((this != MobEffects.INSTANT_HEALTH || entityLivingBaseIn.isEntityUndead()) && (this != MobEffects.INSTANT_DAMAGE || !entityLivingBaseIn.isEntityUndead()))
    {
        if (this == MobEffects.INSTANT_DAMAGE && !entityLivingBaseIn.isEntityUndead() || this == MobEffects.INSTANT_HEALTH && entityLivingBaseIn.isEntityUndead())
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)(6 << p_76394_2_));
        }
    }
    else
    {
        entityLivingBaseIn.heal((float)Math.max(4 << p_76394_2_, 0));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:44,代码来源:Potion.java


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