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


Java EntityLivingBase.getCreatureAttribute方法代碼示例

本文整理匯總了Java中net.minecraft.entity.EntityLivingBase.getCreatureAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityLivingBase.getCreatureAttribute方法的具體用法?Java EntityLivingBase.getCreatureAttribute怎麽用?Java EntityLivingBase.getCreatureAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.EntityLivingBase的用法示例。


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

示例1: apply

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (amplifier >= 3) {
		if (entity instanceof EntityWitch) {
			entity.setFire(500);
			entity.attackEntityFrom(DamageSource.MAGIC, 20);
		} else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) {
			entity.addPotionEffect(new PotionEffect(MobEffects.WITHER, 1500, 0));
			entity.attackEntityFrom(DamageSource.MAGIC, 20);
		}
	} else if (amplifier == 2 && entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER || entity instanceof EntityWitch) {
		entity.attackEntityFrom(DamageSource.MAGIC, 16);
	} else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) {
		entity.attackEntityFrom(DamageSource.MAGIC, 10);
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:17,代碼來源:OutcastsShameBrew.java

示例2: hitEntity

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, @Nonnull EntityLivingBase attacker) {
	if (!target.world.isRemote) {
		if (target.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD && attacker instanceof EntityPlayer) {
			target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12);
			stack.damageItem(25, attacker);
		} else {
			stack.damageItem(1, attacker);
		}
	}

	return true;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:14,代碼來源:ItemSilverAxe.java

示例3: apply

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (entity.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) {
		if (amplifier >= 3) {
			entity.attackEntityFrom(DamageSource.MAGIC, 20);
		} else if (amplifier == 2) {
			entity.attackEntityFrom(DamageSource.MAGIC, 16);
		} else {
			entity.attackEntityFrom(DamageSource.MAGIC, 10);
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:13,代碼來源:BaneArthropodsBrew.java

示例4: onEntityDamaged

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
/**
 * Called whenever a mob is damaged with an item that has this enchantment on it.
 */
public void onEntityDamaged(EntityLivingBase user, Entity target, int level)
{
    if (target instanceof EntityLivingBase)
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)target;

        if (this.damageType == 2 && entitylivingbase.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)
        {
            int i = 20 + user.getRNG().nextInt(10 * level);
            entitylivingbase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, i, 3));
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:EnchantmentDamage.java

示例5: onEntityDamaged

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
/**
 * Called whenever a mob is damaged with an item that has this enchantment on it.
 */
public void onEntityDamaged(EntityLivingBase user, Entity target, int level)
{
    if (target instanceof EntityLivingBase)
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)target;

        if (this.damageType == 2 && entitylivingbase.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)
        {
            int i = 20 + user.getRNG().nextInt(10 * level);
            entitylivingbase.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, i, 3));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:EnchantmentDamage.java

示例6: apply

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (entity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD) {
		entity.attackEntityFrom(DamageSource.MAGIC, 0.5f + (float) amplifier / 4f);
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:7,代碼來源:RottingBrew.java


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