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


Java EntityLivingBase.getEntityAttribute方法代码示例

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


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

示例1: onHurtEvent

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@SubscribeEvent
public static void onHurtEvent(LivingHurtEvent event)
{
    EntityLivingBase entity = event.getEntityLiving();
    DamageSource damageSource = event.getSource();
    float damage = event.getAmount();
    if(entity != null)
    {
        IAttributeInstance damageRate = null;
        if(isPhysicalDamage(damageSource))
            damageRate = entity.getEntityAttribute(PHYSICAL_DAMAGE_RATE);
        if(damageSource.isFireDamage())
            damageRate = entity.getEntityAttribute(FIRE_DAMAGE_RATE);

        if(damageRate != null)
            damage *= damageRate.getAttributeValue();
    }
    event.setAmount(damage);
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:20,代码来源:Attributes.java

示例2: getWeaponDamage

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public float getWeaponDamage(ItemStack stack, EntityLivingBase living, Entity target) {
	float damage = ItemFromData.getData(stack).getFloat(PropertyType.DAMAGE);
	if(living == null || living!=target){
		damage=TF2Attribute.getModifier("Damage", stack,damage, living);
		if (living != null && (this.isDoubleWielding(living) || living.isHandActive()))
			damage *= 0.85f;
		if (target != null && !target.isBurning())
			damage = TF2Attribute.getModifier("Damage Non Burn", stack, damage, living);
		if (target != null && target.isBurning())
			damage = TF2Attribute.getModifier("Damage Burning", stack, damage, living);
		if (living != null && living.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE) != null){
			//System.out.println("Pre "+damage);
			damage=(float) calculateModifiers(living.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE),ATTACK_DAMAGE_MODIFIER,damage,1D/9D);
			//System.out.println("Post "+damage);
		}
		
	}
	return damage;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:21,代码来源:ItemWeapon.java

示例3: getFiringSpeed

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public int getFiringSpeed(ItemStack stack, EntityLivingBase living) {
	int speed=(int) (TF2Attribute.getModifier("Fire Rate", stack,
			ItemFromData.getData(stack).getInt(PropertyType.FIRE_SPEED), living));
	if(living != null && this.isDoubleWielding(living))
		speed *= this.getDoubleWieldBonus(stack, living);
	if(TF2Attribute.getModifier("Fire Rate Health", stack, 1f, living) != 1f)
		speed *= this.getHealthBasedBonus(stack, living, TF2Attribute.getModifier("Fire Rate Health", stack, 1f, living));
	if(living != null && (WeaponsCapability.get(living).isExpJump() || living.isElytraFlying()) && TF2Attribute.getModifier("Airborne Bonus", stack, 0, living) != 0)
		speed *= 0.35f;
	if(living != null && living.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED)!=null){
		//System.out.println("Pre speed "+speed+" "+living.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getBaseValue());
		double modifiers=calculateModifiers(living.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED),ATTACK_SPEED_MODIFIER,living.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getBaseValue(),1.4);
		speed *= (living instanceof EntityPlayer? 4:living.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getBaseValue())/modifiers;
		//System.out.println("Post speed "+speed);
	}
	return speed;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:18,代码来源:ItemUsable.java

示例4: netherFortressArmor

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/** Handle wearing nether fortress armor */
private boolean netherFortressArmor(LivingHurtEvent e) {
	EntityLivingBase hurt = e.getEntityLiving();

	// do things based on the armor status
	int armorCount = getWearingSetCount(hurt, ItemArmorNether.class);
	if(armorCount > 0) {
		
		// knockback resistance
		IAttributeInstance inst = hurt.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE);
		AttributeModifier mod = new AttributeModifier(knockbackID, "nfakb", armorCount / 4D, 0).setSaved(false);
		if(inst.getModifier(knockbackID) == null) inst.applyModifier(mod);

		// wither thorns
		if(e.getSource().getTrueSource() != null && e.getSource().getTrueSource() instanceof EntityLivingBase) {
			EntityLivingBase attacker = (EntityLivingBase)e.getSource().getTrueSource();
			attacker.addPotionEffect(new PotionEffect(MobEffects.WITHER, armorCount * 20, armorCount > 2 ? 1 : 0));
		}

		// blast resistance I
		if(e.getSource().isExplosion()) {
			e.setAmount(e.getAmount() * (1 - armorCount / 8F));
		}
		
		return true;
	}
	return false;
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:29,代码来源:ArmorHandler.java

示例5: resetStatus

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/** Reset some stuff every tick */
@SubscribeEvent
public void resetStatus(LivingUpdateEvent e) {
	EntityLivingBase guy = e.getEntityLiving();
	if(!guy.world.isRemote) {

		// nether fortress stuff
		IAttributeInstance inst = guy.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE);
		if(inst.getModifier(knockbackID) != null) inst.removeModifier(knockbackID);

	}
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:13,代码来源:ArmorHandler.java


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