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


Java EnumCreatureAttribute类代码示例

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


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

示例1: addCollisionBoxToList

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
	if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)) {
		collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
	}
	if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)) {
		entityIn.attackEntityFrom(DamageSource.MAGIC, 1);
	}
	if (entityIn instanceof EntityBlaze) {
		collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
	}
	if (entityIn instanceof EntityEnderman) {
		collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
	}
	if (entityIn instanceof EntityGhast) {
		collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
	}
	if (entityIn instanceof EntityVex) {
		collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:23,代码来源:BlockSaltBarrier.java

示例2: apply

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的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

示例3: updateTick

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
{
	if (!world.isRemote)
	{
		world.scheduleUpdate(pos, this, 5);
		AxisAlignedBB axisalignedbb = this.getCollisionBoundingBox(world, pos, state).expand(6, 6, 6);
		List<EntityMob> list = world.getEntitiesWithinAABB(EntityMob.class, axisalignedbb);
		for (EntityMob mob : list)
		{
			if (mob.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
			{
				mob.setFire(20);
			}
		}
	}
}
 
开发者ID:MinestrapTeam,项目名称:Minestrappolation-4,代码行数:18,代码来源:BlockGodstone.java

示例4: shouldDefend

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@Override
public boolean shouldDefend(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, ArmourSlot slot) {

    Entity entity = source.getSourceOfDamage();

    if (entity == null) {
        return false;
    }

    if (!(entity instanceof EntityMob)) {
        return false;
    }

    EntityMob entityMob = (EntityMob) entity;

    return entityMob.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
}
 
开发者ID:chbachman,项目名称:ModularArmour,代码行数:18,代码来源:UpgradeUndead.java

示例5: shouldDefend

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@Override
public boolean shouldDefend(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, ArmourSlot slot) {
    Entity entity = source.getSourceOfDamage();

    if (entity == null) {
        return false;
    }

    if (!(entity instanceof EntityMob)) {
        return false;
    }

    EntityMob entityMob = (EntityMob) entity;

    return entityMob.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD;
}
 
开发者ID:chbachman,项目名称:ModularArmour,代码行数:17,代码来源:UpgradeArthropod.java

示例6: shouldSilverHurt

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
public static boolean shouldSilverHurt(EntityLivingBase target) 
{
	Class enClass = target.getClass();
	String name = "";
	if(enClass != null && EntityList.classToStringMapping.get(enClass) != null)
	{
		name = (String) EntityList.classToStringMapping.get(enClass);
	}
	
	if (target.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) 
	{
		return true;
	}
	if (name.endsWith("Werewolf")) 
	{
		return true;
	}
	
	return false;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:21,代码来源:ItemArmourMFOld.java

示例7: shouldDamage

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@Override
public boolean shouldDamage(DamageSource source) 
{
	if(material == EnumArmourMF.GUILDED)
	{
		if(source.getSourceOfDamage() != null && source.getSourceOfDamage() instanceof EntityLivingBase)
		{
			if(((EntityLivingBase)source.getSourceOfDamage()).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
			{
				return false;
			}
		}
	}
	if(material == EnumArmourMF.DRAGONFORGE)
	{
		if(source.isFireDamage())
		{
			return false;
		}
	}
	return true;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:23,代码来源:ItemHoundArmourMF.java

示例8: hitEntity

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@Override
public boolean hitEntity(ItemStack weapon, EntityLiving target, EntityLiving user)
   {
	if(this.toolMaterial == ToolMaterialMedieval.DRAGONFORGE)
		target.setFire(20);
	
	if(this.toolMaterial == ToolMaterialMedieval.IGNOTUMITE)
	{
		user.heal(2);
	}
	if(this.toolMaterial == ToolMaterialMedieval.ORNATE)
	{
		if (((EntityLiving) target).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD || target.getClass().getName().endsWith("MoCEntityWarewolf"))
		{
			target.setFire(20);
			target.worldObj.playSoundAtEntity(target, "random.fizz", 1, 1);
		}
	}
	
       return super.hitEntity(weapon, target, user);
   }
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:22,代码来源:ItemHoundWeaponMF.java

示例9: getDamage

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@Override
public float getDamage(Entity tar)
   {
	float dam = weaponDamage;
	
	if(tar != null && tar instanceof EntityLiving && toolMaterial == ToolMaterialMedieval.ORNATE)
	{
		if (((EntityLiving) tar).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD || tar.getClass().getName().endsWith("MoCEntityWarewolf"))
		{
			if(tar.getClass().getName().endsWith("MoCEntityWarewolf"))
			{
				dam *= 10;
			}
			else
			{
				dam *= 2;
			}
		}
	}
	
       return dam;
   }
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:23,代码来源:ItemHoundWeaponMF.java

示例10: getHearing

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
public static int getHearing(Entity entity)
{
	if(entity instanceof ISpecialSenses)
	{
		return((ISpecialSenses)entity).getSight();
	}
	if(entity instanceof EntityMob)
	{
		if(((EntityMob)entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
		{
			return 10;
		}
	}
	
	return 5;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:17,代码来源:TacticalManager.java

示例11: onUpdate

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@Override
public void onUpdate(ItemStack is, World w, Entity ent, int time, boolean holding) {
	if (ent instanceof EntityLivingBase) {
		final EntityLivingBase el = (EntityLivingBase) ent;
		if (el.getEquipmentInSlot(0) == null)
			return;
		if (el.getEquipmentInSlot(0).getItem() != this)
			return;
		else if (el.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
			return;
		else if (!el.isPotionActive(Potion.wither.id)) {
			el.addPotionEffect(new PotionEffect(Potion.wither.id, 41, 0));
		}
	}
	super.onUpdate(is, w, ent, time, holding);
}
 
开发者ID:TheDaemoness,项目名称:IceAndShadow2,代码行数:17,代码来源:NyxItemExousium.java

示例12: doShadowAttack

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
public void doShadowAttack(EntityLivingBase par1EntityLiving, float par2) {
	final boolean harm_undead = par1EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
	final EntityThrowable entityball = new EntityShadowBall(worldObj, this, harm_undead,
			IaSWorldHelper.getRegionLevel(par1EntityLiving) >= 6);

	final double d0 = par1EntityLiving.posX + par1EntityLiving.motionX - posX;
	final double d1 = par1EntityLiving.posY + par1EntityLiving.getEyeHeight() - getEyeHeight() - posY;
	final double d2 = par1EntityLiving.posZ + par1EntityLiving.motionZ - posZ;
	final float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);

	if (f1 <= 2.0) {
		entityball.setThrowableHeading(d0, d1, d2, 0.40F, 8.0F);
	} else {
		entityball.rotationPitch += 20.0F;
	}
	entityball.setThrowableHeading(d0, d1 + f1 * 0.2F, d2, 0.80F, 8.0F);
	worldObj.spawnEntityInWorld(entityball);
}
 
开发者ID:TheDaemoness,项目名称:IceAndShadow2,代码行数:19,代码来源:EntityNyxSkeleton.java

示例13: hitEntity

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的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

示例14: onEntityDamage

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@SubscribeEvent
public void onEntityDamage(LivingHurtEvent event) {
	DamageSource source = event.getSource();

	Entity attacker = source.getTrueSource();
	if ((attacker instanceof EntityLivingBase) && ((EntityLivingBase) attacker).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) {
		event.setAmount(event.getAmount() * 0.95F);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:10,代码来源:ItemSilverArmor.java

示例15: addCollisionBoxToList

import net.minecraft.entity.EnumCreatureAttribute; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
	if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)) {
		entityIn.attackEntityFrom(DamageSource.MAGIC, 4);
	}
	if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)) {
		entityIn.attackEntityFrom(DamageSource.MAGIC, 4);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:11,代码来源:BlockRagingGrass.java


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