当前位置: 首页>>代码示例>>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;未经允许,请勿转载。