Java 类net.minecraft.entity.monster.IMob 实例源码

项目:Never-Enough-Currency    文件:ModEventHandler.java   
@SubscribeEvent
public static void onLivingDropsEvent(LivingDropsEvent event) {
    if (ConfigHandler.dropMoney && !(event.getEntityLiving() instanceof EntityPlayer) && event.getEntityLiving() instanceof IMob && event.getEntityLiving().getEntityWorld().isRemote == false) {
        if (event.getSource().getTrueSource() != null && event.getSource().getTrueSource() instanceof EntityPlayer && !(event.getSource().getTrueSource() instanceof FakePlayer)) {
            CurrencyUtils.dropMoneyAmount(event.getEntityLiving().getMaxHealth() / ConfigHandler.mobDivisionValue, event.getEntityLiving().getEntityWorld(), event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ);
            return;
        }

        if (event.getSource().getTrueSource() != null && event.getSource().getTrueSource() != null && event.getSource().getTrueSource() instanceof EntityArrow) {
            EntityArrow arrow = (EntityArrow) event.getSource().getTrueSource();
            if (arrow.shootingEntity instanceof EntityPlayer && !(arrow.shootingEntity instanceof FakePlayer)) {
                CurrencyUtils.dropMoneyAmount(event.getEntityLiving().getMaxHealth() / ConfigHandler.mobDivisionValue, event.getEntityLiving().getEntityWorld(), event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ);
                return;
            }
        }
    }
}
项目:SerenityCE    文件:KillAura.java   
private boolean entityMatchesTargetTypes(EntityLivingBase entityLivingBase) {
    boolean matches = false;

    if (entityLivingBase instanceof EntityPlayer) {
        matches = players.getValue();
    } else if (entityLivingBase instanceof IMob) {
        matches = mobs.getValue();
    } else if (entityLivingBase instanceof IAnimals) {
        matches = animals.getValue();
    }

    if (mobs.getValue()) {
        if (entityLivingBase instanceof EntityWolf) {
            EntityWolf wolf = (EntityWolf) entityLivingBase;
            matches = wolf.isAngry();
        }
    }

    return matches;
}
项目:Mods    文件:EntitySentry.java   
@Override
public void applyTasks() {

    //this.targetTasks.addTask(1, new EntityAISentryOwnerHurt(this, true));
    this.targetTasks.addTask(2, new EntityAINearestChecked(this, EntityLivingBase.class, true, false,
            new Predicate<EntityLivingBase>() {
                @Override
                public boolean apply(EntityLivingBase target) {
                    return (((((getAttackFlags() & 2) == 2 && getOwnerId() != null) && target instanceof EntityPlayer) 
                            || target.getTeam() != null
                            || ((getAttackFlags() & 1) == 1 && (getRevengeTarget()==target || (getOwner() != null && getOwner().getRevengeTarget()==target)))
                            || ((getAttackFlags() & 4) == 4 && target instanceof IMob && getOwnerId() != null)
                            || ((getAttackFlags() & 4) == 4 && target instanceof EntityLiving && ((EntityLiving) target).getAttackTarget() == getOwner()))
                            || ((getAttackFlags() & 8) == 8 && !(target instanceof EntityPlayer) && !(target instanceof IMob) && getOwnerId() != null))
                            && (!TF2Util.isOnSameTeam(EntitySentry.this, target))
                            && (!(target instanceof EntityTF2Character && TF2ConfigVars.naturalCheck.equals("Never"))
                                    || !((EntityTF2Character) target).natural);

                }
            }, false));
    this.tasks.addTask(1, new EntityAISentryAttack(this));
    this.tasks.addTask(2, new EntityAISentryIdle(this));
}
项目:Mods    文件:TF2EventsCommon.java   
@SubscribeEvent
public void onSpawn(EntityJoinWorldEvent event) {
    if (TF2ConfigVars.targetSentries && event.getEntity() instanceof IMob && event.getEntity() instanceof EntityCreature) {
        ((EntityCreature)event.getEntity()).targetTasks.addTask(100, 
                new EntityAINearestAttackableTarget<EntitySentry>((EntityCreature) event.getEntity(), EntitySentry.class, 10, true, false, sentry -> {
            return sentry.getOwnerId() != null;
        }) {
            protected double getTargetDistance()
            {
                return super.getTargetDistance() * 0.45f;
            }
        });
    }
    if (event.getEntity() instanceof EntityPlayer){
        if (event.getEntity().world.isRemote) {
            if (event.getEntity() == ClientProxy.getLocalPlayer())
                TF2weapons.network.sendToServer(new TF2Message.InitClientMessage(TF2weapons.conf));
            TF2weapons.network.sendToServer(new TF2Message.ActionMessage(99, (EntityLivingBase) event.getEntity()));
        }
        if (event.getEntity().world != null && !event.getEntity().world.isRemote && event.getEntity() instanceof EntityPlayerMP){
            EntityPlayerMP player=((EntityPlayerMP)event.getEntity());
            player.inventoryContainer.addListener(new TF2ContainerListener(player));
        }
    }
}
项目:Overlord    文件:EntityArmyMember.java   
@SuppressWarnings("unchecked")
/*
  Register targeting tasks here
    */
public void addTargetTasks() {
    switch (dataManager.get(ATTACK_MODE)) {
        case 2:
            this.targetTasks.addTask(2, new EntityAIMasterHurtTarget(this));
        case 1:
            this.targetTasks.addTask(1, new EntityAIMasterHurtByTarget(this));
            this.targetTasks.addTask(1, new EntityAIHurtByNonAllied(this, true));
            this.targetTasks.addTask(2, new EntityAINearestNonTeamTarget(this, EntityPlayer.class, true));
            this.targetTasks.addTask(2, new EntityAINearestNonTeamTarget(this, EntityArmyMember.class, true));
            this.targetTasks.addTask(3, new EntityAINearestNonTeamTarget(this, IMob.class, true));
            break;
        case 0:
        default:
            this.setAttackTarget(null);
            this.setRevengeTarget(null);
            break;
    }
}
项目:CrystalMod    文件:EntityUtil.java   
public static List<EntityLivingBase> attackEntitiesInArea(World world, List<EntityLivingBase> targets, DamageSource damageSource, float damage, boolean attackMobs){
    List<EntityLivingBase> attacked = Lists.newArrayList();
    for(Object obj : targets){
        if(obj instanceof EntityLivingBase){
            EntityLivingBase atEntity = (EntityLivingBase) obj;

            boolean isMob = attackMobs;

            if(atEntity instanceof IMob){
                if(!isMob)continue;
            } else if(isMob) {
                continue;
            }

            if(damageSource == null || atEntity.attackEntityFrom(damageSource, damage)){
                attacked.add(atEntity);
            }
        }
       }
    return attacked;
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityJenGolem.java   
public EntityJenGolem(World p_i1694_1_)
{
    super(p_i1694_1_);
    this.setSize(1.4F, 2.9F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityCandyMan.java   
public EntityCandyMan(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
    this.hasCustomNameTag();
    this.setCustomNameTag("�2The Candy Man");
    addRandomArmor();
    DungeonHooks.addDungeonMob("�2The Candy Man", 180);
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityPat.java   
public EntityPat(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
    this.hasCustomNameTag();
    this.setCustomNameTag("FuriousDestroyer");

    addRandomArmor();
    DungeonHooks.addDungeonMob("FuriousDestroyer", 180);
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityCaptianCookie.java   
public EntityCaptianCookie(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));

    this.hasCustomNameTag();
    this.setCustomNameTag("Captian Cookie");
    addRandomArmor();
    DungeonHooks.addDungeonMob("Captian Cookie", 180);
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityJen.java   
public EntityJen(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
    this.hasCustomNameTag();
    this.setCustomNameTag("SuperGirlyGamer");
    addRandomArmor();
    DungeonHooks.addDungeonMob("SuperGirlyGamer", 180);
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityPatGolem.java   
public EntityPatGolem(World p_i1694_1_)
{
    super(p_i1694_1_);
    this.setSize(1.4F, 2.9F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityBellie.java   
public EntityBellie(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));

    this.hasCustomNameTag();
    //this.setCustomNameTag("Captian Cookie");
    addRandomArmor();
    //DungeonHooks.addDungeonMob("Captian Cookie", 180);
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntitySpookyPat.java   
public EntitySpookyPat(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
    this.hasCustomNameTag();
    this.setCustomNameTag("FuriousDestroyer");

    addRandomArmor();
    DungeonHooks.addDungeonMob("FuriousDestroyer", 180);
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntitySpookyJen.java   
public EntitySpookyJen(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
    this.hasCustomNameTag();
    this.setCustomNameTag("SuperGirlyGamer");
    addRandomArmor();
    DungeonHooks.addDungeonMob("SuperGirlyGamer", 180);
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityGingerBreadMan.java   
public EntityGingerBreadMan(World var1)
{
    super(var1);
    world = var1;
    experienceValue = 5;
    this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
    this.hasCustomNameTag();
    this.setCustomNameTag("GingerBreadMan");

    addRandomArmor();
    DungeonHooks.addDungeonMob("GingerBreadMan", 180);
}
项目:Resilience-Client-Source    文件:EntityPlayer.java   
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase par1EntityLivingBase)
{
    if (par1EntityLivingBase instanceof IMob)
    {
        this.triggerAchievement(AchievementList.killEnemy);
    }

    int var2 = EntityList.getEntityID(par1EntityLivingBase);
    EntityList.EntityEggInfo var3 = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(var2));

    if (var3 != null)
    {
        this.addStat(var3.field_151512_d, 1);
    }
}
项目:Progression    文件:FilterEntityType.java   
@Override
protected boolean matches(EntityLivingBase entity) {
    if (type == BOSS) return !entity.isNonBoss();
    else if (!entity.isNonBoss()) return false;

    switch (type) {
        case ANIMAL:    return entity instanceof EntityAnimal;
        case MONSTER:   return entity instanceof IMob;
        case TAMEABLE:  return entity instanceof IEntityOwnable;
        case PLAYER:    return entity instanceof EntityPlayer;
        case WATER:     return entity instanceof EntityWaterMob || entity instanceof EntityGuardian;
        case NPC:       return entity instanceof INpc;
        case GOLEM:     return entity instanceof EntityGolem;
        default:        return false;
    }
}
项目:Gadomancy    文件:FamiliarController.java   
private List<EntityLivingBase> getAttackableEntities(double rad) {
    double x = owningPlayer.posX;
    double y = owningPlayer.posY;
    double z = owningPlayer.posZ;
    List<EntityLivingBase> entities = owningPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class,
            AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(rad, rad, rad));

    Iterator<EntityLivingBase> it = entities.iterator();
    while (it.hasNext()) {
        EntityLivingBase base = it.next();
        if (base == null || base.isDead || base instanceof EntityPlayer || !(base instanceof IMob)) it.remove();
        //TODO remove entities we don't want to attack...
    }

    return entities;
}
项目:MineFantasy    文件:EntityMinotaur.java   
private void setTitan()
   {
    if(worldObj.isRemote)
    {
        return;
    }
    experienceValue = 250;
    this.stepHeight = 1.0F;
    this.jumpMovementFactor = 0.02F * 1.5F;
    this.setSize(1.5F, 4.5F);
    isTitan = true;
       this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.5F);
       this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(7.0D);
       this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(120D);
       this.setHealth(getMaxHealth());
       this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, IMob.class, 0, false));
}
项目:rpginventory    文件:CustomMinionEntitySelector.java   
@Override
public boolean isEntityApplicable(Entity var1) {
    // This class lets the minion know if they should attack the mob they
    // are looking at or not.
    // Never attack the owner, even if he attacks them.

    if (var1 != owner) {
        if (var1 instanceof EntityTameable) {
            if (((EntityTameable) var1).getOwner() != owner) {
                return true;
            } else {
                return false;
            }
        }
        if (var1 instanceof IMob) {
            return true;
        }
    }
    return false;
}
项目:rpginventory    文件:BeastMasterPet.java   
private BeastMasterPet(World par1World) {
    super(par1World);
    this.moveSpeed = 0.35F;

    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 5.0F, 2.0F));
    this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(8, new EntityAITempt(this, 0.5D, RpgMastersAddon.whistle,false));
    this.tasks.addTask(9, new EntityAIWatchClosest(this,EntityLivingBase.class, 8.0F));
    this.tasks.addTask(9, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));

    this.tasks.addTask(1, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 0.1F));

    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,IMob.class, 0, true));
}
项目:4Space-1.7    文件:EntityVenusianVillager.java   
@Override
public void onDeath(DamageSource par1DamageSource) {
    if (this.villageObj != null) {
        final Entity entity = par1DamageSource.getEntity();

        if (entity != null) {
            if (entity instanceof EntityPlayer) {
                this.villageObj.setReputationForPlayer(((EntityPlayer) entity).getCommandSenderName(), -2);
            } else if (entity instanceof IMob) {
                this.villageObj.endMatingSeason();
            }
        } else if (entity == null) {
            final EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 16.0D);

            if (entityplayer != null) {
                this.villageObj.endMatingSeason();
            }
        }
    }
    super.onDeath(par1DamageSource);
}
项目:sprinkles_for_vanilla    文件:WorldHandlers.java   
private static EnumCreatureType getCreatureType(EntityLiving entity)
{
    Class<? extends EntityLiving> entityClass = entity.getClass();
    if (IMob.class.isAssignableFrom(entityClass))
    {
        return EnumCreatureType.MONSTER;
    }
    else if (EntityAnimal.class.isAssignableFrom(entityClass))
    {
        return EnumCreatureType.CREATURE;
    }
    else if (EntityAmbientCreature.class.isAssignableFrom(entityClass))
    {
        return EnumCreatureType.AMBIENT;
    }
    else if (EntityWaterMob.class.isAssignableFrom(entityClass))
    {
        return EnumCreatureType.WATER_CREATURE;
    }
    else
    {
        return null;
    }
}
项目:MinExtension    文件:EntityGoldGolem.java   
public EntityGoldGolem(World par1World)
{
    super(par1World);
    this.setSize(1.4F, 2.9F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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 EntityAIGoldGolemLookAtVillager(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
}
项目:MinExtension    文件:EntityDiamondGolem.java   
public EntityDiamondGolem(World par1World)
{
    super(par1World);
    this.setSize(1.4F, 2.9F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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 EntityAIDiamondGolemLookAtVillager(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(2, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
}
项目:MobTotems    文件:BlazeLogic.java   
@Override
public void performEffect(World world, BlockPos pos, Modifiers modifiers) {
    int radius = DEFAULT_RADIUS + (int) (RANGE_BOOST * modifiers.range);
    AxisAlignedBB aabb = new AxisAlignedBB(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius, pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius);
    List<Entity> teList = world.getEntitiesWithinAABB(Entity.class, aabb);

    for (Entity entity : teList) {
        if (entity instanceof IMob) {
            if (entity.getPosition().getDistance(pos.getX(), pos.getY(), pos.getZ()) <= radius) {
                if (!entity.isImmuneToFire()) {
                    entity.setFire(FIRE_DURATION);
                    entity.attackEntityFrom(DamageSource.ON_FIRE, LlamaLogic.DAMAGE_MODIFIER * modifiers.damage);
                }
            }
        }
    }
}
项目:MobTotems    文件:SpiderLogic.java   
@Override
public void performEffect(World world, BlockPos pos, Modifiers modifiers) {
    int radius = DEFAULT_RADIUS + (int) (RANGE_BOOST * modifiers.range);
    AxisAlignedBB aabb = new AxisAlignedBB(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius, pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius);
    List<EntityLivingBase> teList = world.getEntitiesWithinAABB(EntityLivingBase.class, aabb);

    for (EntityLivingBase entity : teList) {
        if (entity instanceof IMob) {
            if (entity.getPosition().getDistance(pos.getX(), pos.getY(), pos.getZ()) <= radius) {
                PotionEffect potionEffect = new PotionEffect(MobEffects.POISON, POISON_DURATION, POTION_AMPLIFIER);
                if (entity.isPotionApplicable(potionEffect)) {
                    entity.attackEntityFrom(DamageSource.MAGIC, LlamaLogic.DAMAGE_MODIFIER * modifiers.damage);
                    entity.addPotionEffect(potionEffect);
                }
            }
        }
    }
}
项目:NausicaaMod    文件:EntityRobot.java   
public EntityRobot(World par1World)
{
    super(par1World);
    this.setSize(1.4F, 2.9F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAIAttackOnCollide(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));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
}
项目:projectzulu1.7.10-pre-1.3a    文件:EntityBear.java   
public EntityBear(World par1World) {
    super(par1World);

    getNavigator().setAvoidsWater(true);
    tasks.addTask(0, new EntityAISwimming(this));
    tasks.addTask(1, new EntityAIPanic(this, 1.25f));

    /* Attack On Collide Declared in SubClass */
    tasks.addTask(5, new EntityAIMate(this, 1.0f));
    tasks.addTask(6, new EntityAITempt(this, 1.2f, Items.spider_eye, false));
    tasks.addTask(7, new EntityAIFollowParent(this, 1.1f));
    tasks.addTask(9, new EntityAIWander(this, 1.0f, 120));

    targetTasks.addTask(3, new EntityAIHurtByTarget(this, false, false));
    targetTasks.addTask(4,
            new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking),
                    EntityPlayer.class, 16.0F, 0, true));
    targetTasks.addTask(4,
            new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking),
                    EntityLiving.class, 16.0F, 0, false, true, IMob.mobSelector));
}
项目:projectzulu1.7.10-pre-1.3a    文件:EntityTreeEnt.java   
public EntityTreeEnt(World par1World) {
    super(par1World);
    setSize(1.7f, 3.0f);

    getNavigator().setAvoidsWater(true);
    tasks.addTask(0, new EntityAISwimming(this));
    tasks.addTask(1, new EntityAIPanic(this, 1.25f));

    tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0f, false));
    // tasks.addTask(4, new EntityAIFollowOwner(this, moveSpeed, 10.0F, 2.0F));

    // tasks.addTask(5, new EntityAIMate(this, moveSpeed));
    // tasks.addTask(6, new EntityAITempt(this, moveSpeed, Blocks.tallgrass, false));
    // tasks.addTask(7, new EntityAIFollowParent(this, moveSpeed));
    tasks.addTask(9, new EntityAIWander(this, 1.0f, 120));

    targetTasks.addTask(3, new EntityAIHurtByTarget(this, false, false));
    targetTasks.addTask(4,
            new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking),
                    EntityPlayer.class, 16.0F, 0, true));
    targetTasks.addTask(4,
            new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking),
                    EntityLiving.class, 16.0F, 0, false, true, IMob.mobSelector));
}
项目:N-API    文件:EntityRegistry.java   
/**
 * Adds a monster spawn to all of the biomes.
 * @param spawnClazz The class of the entity that is to be spawned when the entry is registered.
 * @param chance The chance the entity has of spawning.
 * @param minGroupCount The smallest number of mobs there can be in a group of mobs spawned.
 * @param maxGroupCount The largest number of mobs there can be in a group of mobs spawned.
 */
public static final void addMonsterSpawnToAll(Class<? extends Entity> spawnClazz, int chance, int minGroupCount, int maxGroupCount)
{
    try 
    {
        BiomeGenBase.SpawnListEntry spawn = constructSpawnEntryFromArgs(spawnClazz, chance, minGroupCount, maxGroupCount);

        if (spawn.entityClass.newInstance() instanceof IMob)
        {
            for (int i = 0; i == biomes.length; i++)
            {
                biomes[i].spawnableMonsterList.add(spawn);
            }
        }
    }
    catch (InstantiationException | IllegalAccessException e) 
    {
        e.printStackTrace();
    }
}
项目:RoboWarsInvasion    文件:EntityBotShoot.java   
public EntityBotShoot(World p_i1738_1_) {
    super(p_i1738_1_);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 30, 10.0F));
    this.tasks.addTask(3, new EntityAIWander(this, 0.40D));
    this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityAgeable.class, 8.0F));
    this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityMob.class, 16.0F));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, false));
    this.targetTasks.addTask(3, new AINearestAttackableTargetNonCreeper(this, EntityLiving.class, 10, false, true, IMob.field_175450_e));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.tasks.addTask(8, this.aiArrowAttack);
    //this.tasks.addTask(7, this.aiAttackOnCollide);
    this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityLiving.class,16.0F));


}
项目:ZeldaSwordSkills    文件:EntityNpcBase.java   
public EntityNpcBase(World world) {
    super(world);
    this.setSize(0.6F, 1.8F);
    this.enablePersistence();
    ((PathNavigateGround) this.getNavigator()).setBreakDoors(true);
    ((PathNavigateGround) this.getNavigator()).setAvoidsWater(true);
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIAvoidEntity<Entity>(this, Entity.class, new Predicate<Entity>() {
        public boolean apply(Entity entity) {
            return entity instanceof IMob;
        }
    }, 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(6, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
    this.tasks.addTask(6, new EntityAIWander(this, 0.6D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
}
项目:RuneCraftery    文件:EntityVillager.java   
public void func_70645_a(DamageSource p_70645_1_) {
   if(this.field_70954_d != null) {
      Entity var2 = p_70645_1_.func_76346_g();
      if(var2 != null) {
         if(var2 instanceof EntityPlayer) {
            this.field_70954_d.func_82688_a(((EntityPlayer)var2).func_70005_c_(), -2);
         } else if(var2 instanceof IMob) {
            this.field_70954_d.func_82692_h();
         }
      } else if(var2 == null) {
         EntityPlayer var3 = this.field_70170_p.func_72890_a(this, 16.0D);
         if(var3 != null) {
            this.field_70954_d.func_82692_h();
         }
      }
   }

   super.func_70645_a(p_70645_1_);
}
项目:RuneCraftery    文件:EntityIronGolem.java   
public EntityIronGolem(World p_i1694_1_) {
   super(p_i1694_1_);
   this.func_70105_a(1.4F, 2.9F);
   this.func_70661_as().func_75491_a(true);
   this.field_70714_bg.func_75776_a(1, new EntityAIAttackOnCollide(this, 1.0D, true));
   this.field_70714_bg.func_75776_a(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F));
   this.field_70714_bg.func_75776_a(3, new EntityAIMoveThroughVillage(this, 0.6D, true));
   this.field_70714_bg.func_75776_a(4, new EntityAIMoveTowardsRestriction(this, 1.0D));
   this.field_70714_bg.func_75776_a(5, new EntityAILookAtVillager(this));
   this.field_70714_bg.func_75776_a(6, new EntityAIWander(this, 0.6D));
   this.field_70714_bg.func_75776_a(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
   this.field_70714_bg.func_75776_a(8, new EntityAILookIdle(this));
   this.field_70715_bh.func_75776_a(1, new EntityAIDefendVillage(this));
   this.field_70715_bh.func_75776_a(2, new EntityAIHurtByTarget(this, false));
   this.field_70715_bh.func_75776_a(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.field_82192_a));
}
项目:The-Derpy-Shiz-Mod    文件:WuerfeliumSword.java   
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean inHand) {
    super.onUpdate(stack,worldIn,entityIn,p_77663_4_,inHand);
    if (inHand && worldIn.getTotalWorldTime() % 10 == 0) {
        boolean found = false;
        AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entityIn.posX-10,entityIn.posY-5,entityIn.posZ-10,entityIn.posX+10,entityIn.posY+5,entityIn.posZ+10);
        List list = worldIn.getEntitiesWithinAABB(IMob.class, box);
        for (int i = 0;i < list.size() && !found; i++) {
            Entity e = (Entity)list.get(i);
            if (e instanceof IMob && !(e instanceof EntityEnderman)) {
                found = true;
            }
        }
         NBTTagCompound tag = stack.getTagCompound();
         if (tag == null) tag = new NBTTagCompound();
         tag.setBoolean("active", found);
         stack.setTagCompound(tag);
    }
}
项目:projectzulu1.7.10    文件:EntityTreeEnt.java   
public EntityTreeEnt(World par1World) {
    super(par1World);
    setSize(1.7f, 3.0f);

    getNavigator().setAvoidsWater(true);
    tasks.addTask(0, new EntityAISwimming(this));
    tasks.addTask(1, new EntityAIPanic(this, 1.25f));

    tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0f, false));
    // tasks.addTask(4, new EntityAIFollowOwner(this, moveSpeed, 10.0F, 2.0F));

    // tasks.addTask(5, new EntityAIMate(this, moveSpeed));
    // tasks.addTask(6, new EntityAITempt(this, moveSpeed, Blocks.tallgrass, false));
    // tasks.addTask(7, new EntityAIFollowParent(this, moveSpeed));
    tasks.addTask(9, new EntityAIWander(this, 1.0f, 120));

    targetTasks.addTask(3, new EntityAIHurtByTarget(this, false, false));
    targetTasks.addTask(4,
            new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking),
                    EntityPlayer.class, 16.0F, 0, true));
    targetTasks.addTask(4,
            new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking),
                    EntityLiving.class, 16.0F, 0, false, true, IMob.mobSelector));
}
项目:Decaying-World    文件:EntityFooDog.java   
public EntityFooDog(World par1World)
{
    super(par1World);
    //this.texture = "/mods/DecayingWorld/textures/mob/foodog.png";
    this.setSize(0.6F, 0.8F);
    //this.moveSpeed = 0.28F;
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    //this.tasks.addTask(2, new EntityAILeapAtTarget(this, 0.4F));
    //this.tasks.addTask(3, new EntityAIAttackOnCollide(this, this.moveSpeed, true));
    //this.tasks.addTask(4, new EntityAIWander(this, this.moveSpeed));
    //this.tasks.addTask(5, new EntityAIMoveTwardsRestriction(this, 0.3F));
    //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, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true, true, IMob.mobSelector));
    setAngry(false);
}
项目:Decaying-World    文件:EntityTreant.java   
public EntityTreant(World par1World)
{
    super(par1World);
    //this.moveSpeed = 0.16F;
    //this.texture = "/mods/DecayingWorld/textures/mob/treant.png";
    this.setSize(1.4F, 2.9F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.288D, false));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityZombie.class, 0.288D, true));
    this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 0.16D));
    this.tasks.addTask(4, new EntityAIWander(this, 0.16D));
    this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(6, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true, true, IMob.mobSelector));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, false, true, IMob.mobSelector));
}