Java 类net.minecraft.entity.EntityLiving 实例源码

项目:harshencastle    文件:EntitySoulPart.java   
@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);
        }
    }));

}
项目:CustomWorldGen    文件:EntityAIFindEntityNearest.java   
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);
}
项目:CustomWorldGen    文件:EntityHorse.java   
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;
        }
    }
}
项目:Backmemed    文件:RandomMobsProperties.java   
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_;
    }
}
项目:CustomWorldGen    文件:ItemElytra.java   
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);
    }
}
项目:CustomWorldGen    文件:EntityIronGolem.java   
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);
        }
    }));
}
项目:CustomWorldGen    文件:ItemArmor.java   
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;
    }
}
项目:uniquecrops    文件:UCEventHandlerServer.java   
@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);
    }
}
项目:CustomWorldGen    文件:EntityAIAttackRanged.java   
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);
    }
}
项目:DecompiledMinecraft    文件:EntityAIFindEntityNearest.java   
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_);
}
项目:Wurst-MC-1.12    文件:MobEspMod.java   
@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);
    }
}
项目:BaseClient    文件:EntityAIFindEntityNearest.java   
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_);
}
项目:Backmemed    文件:EntityAIAttackRanged.java   
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);
    }
}
项目:Backmemed    文件:EntitySelectors.java   
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));
    }
}
项目:Backmemed    文件:ItemElytra.java   
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);
    }
}
项目:BaseClient    文件:EntityWither.java   
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;
}
项目:BaseClient    文件:EntitySelectors.java   
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));
    }
}
项目:DecompiledMinecraft    文件:ItemLead.java   
public static boolean attachToFence(EntityPlayer player, World worldIn, BlockPos fence)
{
    EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(worldIn, fence);
    boolean flag = false;
    double d0 = 7.0D;
    int i = fence.getX();
    int j = fence.getY();
    int k = fence.getZ();

    for (EntityLiving entityliving : worldIn.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB((double)i - d0, (double)j - d0, (double)k - d0, (double)i + d0, (double)j + d0, (double)k + d0)))
    {
        if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == player)
        {
            if (entityleashknot == null)
            {
                entityleashknot = EntityLeashKnot.createKnot(worldIn, fence);
            }

            entityliving.setLeashedToEntity(entityleashknot, true);
            flag = true;
        }
    }

    return flag;
}
项目:DecompiledMinecraft    文件:EntityAIArrowAttack.java   
public EntityAIArrowAttack(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.field_96561_g = p_i1650_4_;
        this.maxRangedAttackTime = maxAttackTime;
        this.field_96562_i = maxAttackDistanceIn;
        this.maxAttackDistance = maxAttackDistanceIn * maxAttackDistanceIn;
        this.setMutexBits(3);
    }
}
项目:DecompiledMinecraft    文件:EntitySelectors.java   
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));
    }
}
项目:DecompiledMinecraft    文件:ItemLead.java   
public static boolean attachToFence(EntityPlayer player, World worldIn, BlockPos fence)
{
    EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(worldIn, fence);
    boolean flag = false;
    double d0 = 7.0D;
    int i = fence.getX();
    int j = fence.getY();
    int k = fence.getZ();

    for (EntityLiving entityliving : worldIn.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB((double)i - d0, (double)j - d0, (double)k - d0, (double)i + d0, (double)j + d0, (double)k + d0)))
    {
        if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == player)
        {
            if (entityleashknot == null)
            {
                entityleashknot = EntityLeashKnot.createKnot(worldIn, fence);
            }

            entityliving.setLeashedToEntity(entityleashknot, true);
            flag = true;
        }
    }

    return flag;
}
项目:CustomWorldGen    文件:EntityRegistry.java   
/**
 * Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list
 * @param entityName The entity name
 * @param weightedProb Probability
 * @param min Min spawn count
 * @param max Max spawn count
 * @param typeOfCreature type of spawn
 * @param biomes List of biomes
 */
@SuppressWarnings("unchecked")
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes)
{
    Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);

    if (EntityLiving.class.isAssignableFrom(entityClazz))
    {
        addSpawn((Class <? extends EntityLiving >) entityClazz, weightedProb, min, max, typeOfCreature, biomes);
    }
}
项目:Backmemed    文件:ItemMonsterPlacer.java   
@Nullable

    /**
     * Spawns the creature specified by the egg's type in the location specified by the last three parameters.
     * Parameters: world, entityID, x, y, z.
     */
    public static Entity spawnCreature(World worldIn, @Nullable ResourceLocation entityID, double x, double y, double z)
    {
        if (entityID != null && EntityList.ENTITY_EGGS.containsKey(entityID))
        {
            Entity entity = null;

            for (int i = 0; i < 1; ++i)
            {
                entity = EntityList.createEntityByIDFromName(entityID, worldIn);

                if (entity instanceof EntityLiving)
                {
                    EntityLiving entityliving = (EntityLiving)entity;
                    entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(worldIn.rand.nextFloat() * 360.0F), 0.0F);
                    entityliving.rotationYawHead = entityliving.rotationYaw;
                    entityliving.renderYawOffset = entityliving.rotationYaw;
                    entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
                    worldIn.spawnEntityInWorld(entity);
                    entityliving.playLivingSound();
                }
            }

            return entity;
        }
        else
        {
            return null;
        }
    }
项目:pnc-repressurized    文件:HackableLivingDisarm.java   
private void doDisarm(EntityLiving entity, Random rand, IItemHandler handler, float[] dropChances) {
    for (int i = 0; i < handler.getSlots(); i++) {
        ItemStack stack = handler.getStackInSlot(i);
        boolean flag1 = dropChances[i] > 1.0F;
        if (!stack.isEmpty() && rand.nextFloat() < dropChances[i]) {
            if (!flag1 && stack.isItemStackDamageable()) {
                int k = Math.max(stack.getMaxDamage() - 25, 1);
                int l = stack.getMaxDamage() - rand.nextInt(rand.nextInt(k) + 1);
                stack.setItemDamage(MathHelper.clamp(l, 1, k));
            }
            entity.entityDropItem(stack, 0f);
        }
        handler.extractItem(i, stack.getCount(), false);
    }
}
项目:CustomWorldGen    文件:EntityWither.java   
protected void initEntityAI()
{
    this.tasks.addTask(0, new EntityWither.AIDoNothing());
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackRanged(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, NOT_UNDEAD));
}
项目:Backmemed    文件:MobSpawnerBaseLogic.java   
public Entity getCachedEntity()
{
    if (this.cachedEntity == null)
    {
        this.cachedEntity = AnvilChunkLoader.readWorldEntity(this.randomEntity.getNbt(), this.getSpawnerWorld(), false);

        if (this.randomEntity.getNbt().getSize() == 1 && this.randomEntity.getNbt().hasKey("id", 8) && this.cachedEntity instanceof EntityLiving)
        {
            ((EntityLiving)this.cachedEntity).onInitialSpawn(this.getSpawnerWorld().getDifficultyForLocation(new BlockPos(this.cachedEntity)), (IEntityLivingData)null);
        }
    }

    return this.cachedEntity;
}
项目:BaseClient    文件:ItemMonsterPlacer.java   
/**
 * Spawns the creature specified by the egg's type in the location specified by the last three parameters.
 * Parameters: world, entityID, x, y, z.
 */
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
    if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
    {
        return null;
    }
    else
    {
        Entity entity = null;

        for (int i = 0; i < 1; ++i)
        {
            entity = EntityList.createEntityByID(entityID, worldIn);

            if (entity instanceof EntityLivingBase)
            {
                EntityLiving entityliving = (EntityLiving)entity;
                entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
                entityliving.rotationYawHead = entityliving.rotationYaw;
                entityliving.renderYawOffset = entityliving.rotationYaw;
                entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
                worldIn.spawnEntityInWorld(entity);
                entityliving.playLivingSound();
            }
        }

        return entity;
    }
}
项目:DecompiledMinecraft    文件:EntityZombie.java   
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase entityLivingIn)
{
    super.onKillEntity(entityLivingIn);

    if ((this.worldObj.getDifficulty() == EnumDifficulty.NORMAL || this.worldObj.getDifficulty() == EnumDifficulty.HARD) && entityLivingIn instanceof EntityVillager)
    {
        if (this.worldObj.getDifficulty() != EnumDifficulty.HARD && this.rand.nextBoolean())
        {
            return;
        }

        EntityLiving entityliving = (EntityLiving)entityLivingIn;
        EntityZombie entityzombie = new EntityZombie(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(entityLivingIn);
        this.worldObj.removeEntity(entityLivingIn);
        entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null);
        entityzombie.setVillager(true);

        if (entityLivingIn.isChild())
        {
            entityzombie.setChild(true);
        }

        entityzombie.setNoAI(entityliving.isAIDisabled());

        if (entityliving.hasCustomName())
        {
            entityzombie.setCustomNameTag(entityliving.getCustomNameTag());
            entityzombie.setAlwaysRenderNameTag(entityliving.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
    }
}
项目:Thermionics    文件:Thermionics.java   
@SubscribeEvent(priority=EventPriority.LOWEST)
public void onEntityAttack(LivingAttackEvent e) {
    if (e.getEntity().getEntityWorld().isRemote) return;

    Entity attacker = e.getSource().getTrueSource();

    if (attacker==null) return; //It's probably just some bat dying in lava
    if (attacker.hasCapability(CAPABILITY_WEAPONSKILL, EnumFacing.UP)) {
        IWeaponSkillInfo skillInfo = attacker.getCapability(CAPABILITY_WEAPONSKILL, EnumFacing.UP);
        if (skillInfo.getCooldown()<=0) {
            //Search for activations
            if (attacker instanceof EntityLivingBase) {

                //Tool activations
                if (e.getSource().damageType.equals("player")) {
                    ItemStack weapon = ((EntityLivingBase)attacker).getHeldItem(((EntityLivingBase) attacker).getActiveHand());
                    if (weapon.getItem() instanceof ISkillActivating) {
                        int activated = ((ISkillActivating) weapon.getItem()).activateSkill(skillInfo, (EntityLivingBase)attacker, weapon, e.getSource(), (EntityLiving) e.getEntityLiving());
                        if (activated>0) {
                            // TODO: Stats? Advancements?
                            skillInfo.setCooldown(activated);
                        }
                    }
                }
            }
        }
    }

    //TODO: Check the defender for armor WeaponSkills
}
项目:ProgressiveDifficulty    文件:AddDamageModifier.java   
@Override
public void handleSpawnEvent(int numInstances, EntityLiving entity) {
    IAttributeInstance maxDamageAttribute = entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
    if(maxDamageAttribute!=null) {
        maxDamageAttribute.setBaseValue(maxDamageAttribute.getBaseValue() + numInstances);
    }
}
项目:ProgressiveDifficulty    文件:FatigueGazeModifier.java   
@Override
public void handleUpkeepEvent(int numChanges, EntityLiving entity) {
    if(entity.getAttackTarget() instanceof EntityPlayer && entity.canEntityBeSeen(entity.getAttackTarget())){
        EntityPlayer player = (EntityPlayer)entity.getAttackTarget();
        player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE,MobUpkeepController.POTION_EFFECT_LENGTH,numChanges,false,true));
    }
}
项目:Backmemed    文件:EntityAIDoorInteract.java   
public EntityAIDoorInteract(EntityLiving entityIn)
{
    this.theEntity = entityIn;

    if (!(entityIn.getNavigator() instanceof PathNavigateGround))
    {
        throw new IllegalArgumentException("Unsupported mob type for DoorInteractGoal");
    }
}
项目:DecompiledMinecraft    文件:PathNavigate.java   
public PathNavigate(EntityLiving entitylivingIn, World worldIn)
{
    this.theEntity = entitylivingIn;
    this.worldObj = worldIn;
    this.pathSearchRange = entitylivingIn.getEntityAttribute(SharedMonsterAttributes.followRange);
    this.pathFinder = this.getPathFinder();
}
项目:BaseClient    文件:EntityAIDoorInteract.java   
public EntityAIDoorInteract(EntityLiving entityIn)
{
    this.theEntity = entityIn;

    if (!(entityIn.getNavigator() instanceof PathNavigateGround))
    {
        throw new IllegalArgumentException("Unsupported mob type for DoorInteractGoal");
    }
}
项目:Industrial-Foregoing    文件:MobSlaughterFactoryTile.java   
@Override
public float work() {
    if (WorkUtils.isDisabled(this.getBlockType())) return 0;

    AxisAlignedBB area = getWorkingArea();
    List<EntityLiving> mobs = this.getWorld().getEntitiesWithinAABB(EntityLiving.class, area);
    if (mobs.size() == 0) return 0;
    EntityLiving mob = mobs.get(this.getWorld().rand.nextInt(mobs.size()));
    this.outMeat.fill(new FluidStack(FluidsRegistry.MEAT, (int) (mob.getHealth() * BlockRegistry.mobSlaughterFactoryBlock.getMeatValue())), true);
    this.outPink.fill(new FluidStack(FluidsRegistry.PINK_SLIME, (int) mob.getHealth()), true);
    mob.setDropItemsWhenDead(false);
    mob.attackEntityFrom(CommonProxy.custom, mob.getMaxHealth());

    return 1;
}
项目:connor41-etfuturum2    文件:ItemEntityEgg.java   
public static Entity spawnEntity(World world, int id, double x, double y, double z) {
    Entity entity = ModEntityList.createEntityByID(id, world);

    if (entity != null && entity instanceof EntityLivingBase) {
        EntityLiving entityliving = (EntityLiving) entity;
        entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
        entityliving.rotationYawHead = entityliving.rotationYaw;
        entityliving.renderYawOffset = entityliving.rotationYaw;
        entityliving.onSpawnWithEgg((IEntityLivingData) null);
        world.spawnEntityInWorld(entity);
        entityliving.playLivingSound();
    }

    return entity;
}
项目:BaseClient    文件:EntityAIWatchClosest.java   
public EntityAIWatchClosest(EntityLiving entitylivingIn, Class <? extends Entity > watchTargetClass, float maxDistance)
{
    this.theWatcher = entitylivingIn;
    this.watchedClass = watchTargetClass;
    this.maxDistanceForPlayer = maxDistance;
    this.chance = 0.02F;
    this.setMutexBits(2);
}
项目:DecompiledMinecraft    文件:ItemMonsterPlacer.java   
/**
 * Spawns the creature specified by the egg's type in the location specified by the last three parameters.
 * Parameters: world, entityID, x, y, z.
 */
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
    if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
    {
        return null;
    }
    else
    {
        Entity entity = null;

        for (int i = 0; i < 1; ++i)
        {
            entity = EntityList.createEntityByID(entityID, worldIn);

            if (entity instanceof EntityLivingBase)
            {
                EntityLiving entityliving = (EntityLiving)entity;
                entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
                entityliving.rotationYawHead = entityliving.rotationYaw;
                entityliving.renderYawOffset = entityliving.rotationYaw;
                entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
                worldIn.spawnEntityInWorld(entity);
                entityliving.playLivingSound();
            }
        }

        return entity;
    }
}
项目:Infernum    文件:ModelPigZombieMage.java   
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw,
        float headPitch, float scaleFactor, Entity entityIn) {
    super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
    this.bipedHood.rotateAngleX = bipedHead.rotateAngleX;
    this.bipedHood.rotateAngleY = bipedHead.rotateAngleY;
    this.bipedHood.rotateAngleZ = bipedHead.rotateAngleZ;
    this.bipedRobe.rotateAngleX = bipedBody.rotateAngleX;
    this.bipedRobe.rotateAngleY = bipedBody.rotateAngleY;
    this.bipedRobe.rotateAngleZ = bipedBody.rotateAngleZ;

    float f = MathHelper.sin(this.swingProgress * (float) Math.PI);
    float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI);
    float f2 = -(float) Math.PI / 3.825F;
    if (((EntityLiving) entityIn).getPrimaryHand() == EnumHandSide.RIGHT) {
        this.bipedRightArm.rotateAngleZ = 0.0F;
        this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F);
        this.bipedRightArm.rotateAngleX = f2;
        this.bipedRightArm.rotateAngleX += f * 1.2F - f1 * 0.4F;
        this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
        this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
    } else {
        this.bipedLeftArm.rotateAngleZ = 0.0F;
        this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F;
        this.bipedLeftArm.rotateAngleX = f2;
        this.bipedLeftArm.rotateAngleX += f * 1.2F - f1 * 0.4F;
        this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
        this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
    }
}
项目:Infernum    文件:EntityPigMage.java   
@Override
public void initEntityAI() {
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityPigZombieMage.class, 8.0F, 0.8D, 0.8D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityPigZombie.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(2, new EntityAIMoveIndoors(this));
    this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this));
    this.tasks.addTask(4, new EntityAIOpenDoor(this, true));
    this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D));
    this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
    this.tasks.addTask(9, new EntityAIWanderAvoidWater(this, 0.6D));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
    this.applyEntityAI();
}