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


Java EntityLiving类代码示例

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


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

示例1: initEntityAI

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
@Override
protected void initEntityAI() {
	this.tasks.addTask(8, new AIEntityFlyingTowardsPlayer(this));
       this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 3.0F, 1.0F));
       this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
	this.tasks.addTask(11, new EntityAILookIdle(this));

	this.targetTasks.addTask(0, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, 10, false, false, new Predicate<EntityLivingBase>() {

		@Override
		public boolean apply(EntityLivingBase input) {
			return !input.isPotionActive(HarshenPotions.potionSoulless);
		}
	}));

}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:17,代码来源:EntitySoulPart.java

示例2: EntityAIFindEntityNearest

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public EntityAIFindEntityNearest(EntityLiving mobIn, Class <? extends EntityLivingBase > p_i45884_2_)
{
    this.mob = mobIn;
    this.classToCheck = p_i45884_2_;

    if (mobIn instanceof EntityCreature)
    {
        LOGGER.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!");
    }

    this.predicate = new Predicate<EntityLivingBase>()
    {
        public boolean apply(@Nullable EntityLivingBase p_apply_1_)
        {
            double d0 = EntityAIFindEntityNearest.this.getFollowRange();

            if (p_apply_1_.isSneaking())
            {
                d0 *= 0.800000011920929D;
            }

            return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.mob) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.mob, p_apply_1_, false, true));
        }
    };
    this.sorter = new EntityAINearestAttackableTarget.Sorter(mobIn);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:EntityAIFindEntityNearest.java

示例3: updatePassenger

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public void updatePassenger(Entity passenger)
{
    super.updatePassenger(passenger);

    if (passenger instanceof EntityLiving)
    {
        EntityLiving entityliving = (EntityLiving)passenger;
        this.renderYawOffset = entityliving.renderYawOffset;
    }

    if (this.prevRearingAmount > 0.0F)
    {
        float f3 = MathHelper.sin(this.renderYawOffset * 0.017453292F);
        float f = MathHelper.cos(this.renderYawOffset * 0.017453292F);
        float f1 = 0.7F * this.prevRearingAmount;
        float f2 = 0.15F * this.prevRearingAmount;
        passenger.setPosition(this.posX + (double)(f1 * f3), this.posY + this.getMountedYOffset() + passenger.getYOffset() + (double)f2, this.posZ - (double)(f1 * f));

        if (passenger instanceof EntityLivingBase)
        {
            ((EntityLivingBase)passenger).renderYawOffset = this.renderYawOffset;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:EntityHorse.java

示例4: getTextureLocation

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public ResourceLocation getTextureLocation(ResourceLocation p_getTextureLocation_1_, EntityLiving p_getTextureLocation_2_)
{
    if (this.rules != null)
    {
        for (int i = 0; i < this.rules.length; ++i)
        {
            RandomMobsRule randommobsrule = this.rules[i];

            if (randommobsrule.matches(p_getTextureLocation_2_))
            {
                return randommobsrule.getTextureLocation(p_getTextureLocation_1_, p_getTextureLocation_2_.randomMobsId);
            }
        }
    }

    if (this.resourceLocations != null)
    {
        int j = p_getTextureLocation_2_.randomMobsId;
        int k = j % this.resourceLocations.length;
        return this.resourceLocations[k];
    }
    else
    {
        return p_getTextureLocation_1_;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:RandomMobsProperties.java

示例5: onItemRightClick

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemStackIn);
    ItemStack itemstack = playerIn.getItemStackFromSlot(entityequipmentslot);

    if (itemstack == null)
    {
        playerIn.setItemStackToSlot(entityequipmentslot, itemStackIn.copy());
        itemStackIn.stackSize = 0;
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
    else
    {
        return new ActionResult(EnumActionResult.FAIL, itemStackIn);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ItemElytra.java

示例6: initEntityAI

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
protected void initEntityAI()
{
    this.tasks.addTask(1, new EntityAIAttackMelee(this, 1.0D, true));
    this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F));
    this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true));
    this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));
    this.tasks.addTask(5, new EntityAILookAtVillager(this));
    this.tasks.addTask(6, new EntityAIWander(this, 0.6D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(8, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIDefendVillage(this));
    this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0]));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 10, false, true, new Predicate<EntityLiving>()
    {
        public boolean apply(@Nullable EntityLiving p_apply_1_)
        {
            return p_apply_1_ != null && IMob.VISIBLE_MOB_SELECTOR.apply(p_apply_1_) && !(p_apply_1_ instanceof EntityCreeper);
        }
    }));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:EntityIronGolem.java

示例7: dispenseArmor

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
{
    BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.getBlockState().getValue(BlockDispenser.FACING));
    List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.<EntityLivingBase>and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));

    if (list.isEmpty())
    {
        return null;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(stack);
        ItemStack itemstack = stack.copy();
        itemstack.stackSize = 1;
        entitylivingbase.setItemStackToSlot(entityequipmentslot, itemstack);

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setDropChance(entityequipmentslot, 2.0F);
        }

        --stack.stackSize;
        return stack;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:ItemArmor.java

示例8: checkSetTarget

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
@SubscribeEvent
public void checkSetTarget(LivingSetAttackTargetEvent event) {
	
	if (event.getTarget() == null)
		return;
	if (!(event.getTarget() instanceof EntityPlayer) || event.getTarget() instanceof FakePlayer)
		return;
	if (!(event.getEntity() instanceof EntityLiving))
		return;
	
	EntityPlayer player = (EntityPlayer)event.getTarget();
	EntityLiving ent = (EntityLiving)event.getEntity();
	boolean flag = player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() == UCItems.poncho && NBTUtils.getInt(player.inventory.armorInventory[2], ItemGeneric.TAG_UPGRADE, -1) == 10;
	if (flag && ent.isNonBoss() && !(ent instanceof EntityGuardian || ent instanceof EntityShulker))
	{
		ent.setAttackTarget(null);
		ent.setRevengeTarget(null);
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:20,代码来源:UCEventHandlerServer.java

示例9: EntityAIAttackRanged

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public EntityAIAttackRanged(IRangedAttackMob attacker, double movespeed, int p_i1650_4_, int maxAttackTime, float maxAttackDistanceIn)
{
    this.rangedAttackTime = -1;

    if (!(attacker instanceof EntityLivingBase))
    {
        throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob");
    }
    else
    {
        this.rangedAttackEntityHost = attacker;
        this.entityHost = (EntityLiving)attacker;
        this.entityMoveSpeed = movespeed;
        this.attackIntervalMin = p_i1650_4_;
        this.maxRangedAttackTime = maxAttackTime;
        this.attackRadius = maxAttackDistanceIn;
        this.maxAttackDistance = maxAttackDistanceIn * maxAttackDistanceIn;
        this.setMutexBits(3);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:EntityAIAttackRanged.java

示例10: EntityAIFindEntityNearest

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public EntityAIFindEntityNearest(EntityLiving p_i45884_1_, Class <? extends EntityLivingBase > p_i45884_2_)
{
    this.field_179442_b = p_i45884_1_;
    this.field_179439_f = p_i45884_2_;

    if (p_i45884_1_ instanceof EntityCreature)
    {
        field_179444_a.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!");
    }

    this.field_179443_c = new Predicate<EntityLivingBase>()
    {
        public boolean apply(EntityLivingBase p_apply_1_)
        {
            double d0 = EntityAIFindEntityNearest.this.func_179438_f();

            if (p_apply_1_.isSneaking())
            {
                d0 *= 0.800000011920929D;
            }

            return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.field_179442_b) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.field_179442_b, p_apply_1_, false, true));
        }
    };
    this.field_179440_d = new EntityAINearestAttackableTarget.Sorter(p_i45884_1_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:EntityAIFindEntityNearest.java

示例11: onUpdate

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
@Override
public void onUpdate()
{
	mobs.clear();
	for(Entity entity : WMinecraft.getWorld().loadedEntityList)
	{
		if(!(entity instanceof EntityLiving))
			continue;
		
		if(!wurst.special.targetSpf.invisibleMobs.isChecked()
			&& entity.isInvisible())
			continue;
		
		mobs.add((EntityLiving)entity);
	}
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:17,代码来源:MobEspMod.java

示例12: apply

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public boolean apply(@Nullable Entity p_apply_1_)
{
    if (!p_apply_1_.isEntityAlive())
    {
        return false;
    }
    else if (!(p_apply_1_ instanceof EntityLivingBase))
    {
        return false;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)p_apply_1_;
        return !entitylivingbase.getItemStackFromSlot(EntityLiving.getSlotForItemStack(this.armor)).func_190926_b() ? false : (entitylivingbase instanceof EntityLiving ? ((EntityLiving)entitylivingbase).canPickUpLoot() : (entitylivingbase instanceof EntityArmorStand ? true : entitylivingbase instanceof EntityPlayer));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:EntitySelectors.java

示例13: onItemRightClick

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemstack);
    ItemStack itemstack1 = worldIn.getItemStackFromSlot(entityequipmentslot);

    if (itemstack1.func_190926_b())
    {
        worldIn.setItemStackToSlot(entityequipmentslot, itemstack.copy());
        itemstack.func_190920_e(0);
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
    else
    {
        return new ActionResult(EnumActionResult.FAIL, itemstack);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:ItemElytra.java

示例14: EntityWither

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public EntityWither(World worldIn)
{
    super(worldIn);
    this.setHealth(this.getMaxHealth());
    this.setSize(0.9F, 3.5F);
    this.isImmuneToFire = true;
    ((PathNavigateGround)this.getNavigator()).setCanSwim(true);
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 40, 20.0F));
    this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, false, attackEntitySelector));
    this.experienceValue = 50;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:EntityWither.java

示例15: apply

import net.minecraft.entity.EntityLiving; //导入依赖的package包/类
public boolean apply(Entity p_apply_1_)
{
    if (!p_apply_1_.isEntityAlive())
    {
        return false;
    }
    else if (!(p_apply_1_ instanceof EntityLivingBase))
    {
        return false;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)p_apply_1_;
        return entitylivingbase.getEquipmentInSlot(EntityLiving.getArmorPosition(this.armor)) != null ? false : (entitylivingbase instanceof EntityLiving ? ((EntityLiving)entitylivingbase).canPickUpLoot() : (entitylivingbase instanceof EntityArmorStand ? true : entitylivingbase instanceof EntityPlayer));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:EntitySelectors.java


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