當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。