Java Code Examples for net.minecraft.entity.monster.IMob

The following are top voted examples for showing how to use net.minecraft.entity.monster.IMob. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Never-Enough-Currency   File: ModEventHandler.java   View source code 6 votes vote down vote up
@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;
			}
		}
	}
}
 
Example 2
Project: SerenityCE   File: KillAura.java   View source code 6 votes vote down vote up
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;
}
 
Example 3
Project: Mods   File: EntitySentry.java   View source code 6 votes vote down vote up
@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));
}
 
Example 4
Project: Mods   File: TF2EventsCommon.java   View source code 6 votes vote down vote up
@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));
		}
	}
}
 
Example 5
Project: Overlord   File: EntityArmyMember.java   View source code 6 votes vote down vote up
@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;
	}
}
 
Example 6
Project: CrystalMod   File: EntityUtil.java   View source code 6 votes vote down vote up
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;
}
 
Example 7
Project: PopularMMOS-EpicProportions-Mod   File: EntityJenGolem.java   View source code 6 votes vote down vote up
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));
}
 
Example 8
Project: PopularMMOS-EpicProportions-Mod   File: EntityCandyMan.java   View source code 6 votes vote down vote up
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);
}
 
Example 9
Project: PopularMMOS-EpicProportions-Mod   File: EntityPat.java   View source code 6 votes vote down vote up
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);
}
 
Example 10
Project: PopularMMOS-EpicProportions-Mod   File: EntityCaptianCookie.java   View source code 6 votes vote down vote up
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);
}
 
Example 11
Project: PopularMMOS-EpicProportions-Mod   File: EntityJen.java   View source code 6 votes vote down vote up
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);
}
 
Example 12
Project: PopularMMOS-EpicProportions-Mod   File: EntityPatGolem.java   View source code 6 votes vote down vote up
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));
}
 
Example 13
Project: PopularMMOS-EpicProportions-Mod   File: EntityBellie.java   View source code 6 votes vote down vote up
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);
}
 
Example 14
Project: PopularMMOS-EpicProportions-Mod   File: EntitySpookyPat.java   View source code 6 votes vote down vote up
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);
}
 
Example 15
Project: PopularMMOS-EpicProportions-Mod   File: EntitySpookyJen.java   View source code 6 votes vote down vote up
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);
}
 
Example 16
Project: PopularMMOS-EpicProportions-Mod   File: EntityGingerBreadMan.java   View source code 6 votes vote down vote up
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);
}
 
Example 17
Project: Resilience-Client-Source   File: EntityPlayer.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 18
Project: Progression   File: FilterEntityType.java   View source code 6 votes vote down vote up
@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;
    }
}
 
Example 19
Project: Gadomancy   File: FamiliarController.java   View source code 6 votes vote down vote up
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;
}
 
Example 20
Project: MineFantasy   File: EntityMinotaur.java   View source code 6 votes vote down vote up
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));
}
 
Example 21
Project: rpginventory   File: CustomMinionEntitySelector.java   View source code 6 votes vote down vote up
@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;
}
 
Example 22
Project: rpginventory   File: BeastMasterPet.java   View source code 6 votes vote down vote up
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));
}
 
Example 23
Project: 4Space-1.7   File: EntityVenusianVillager.java   View source code 6 votes vote down vote up
@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);
}
 
Example 24
Project: sprinkles_for_vanilla   File: WorldHandlers.java   View source code 6 votes vote down vote up
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;
    }
}
 
Example 25
Project: MinExtension   File: EntityGoldGolem.java   View source code 6 votes vote down vote up
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));
}
 
Example 26
Project: MinExtension   File: EntityDiamondGolem.java   View source code 6 votes vote down vote up
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));
}
 
Example 27
Project: MobTotems   File: BlazeLogic.java   View source code 6 votes vote down vote up
@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);
                }
            }
        }
    }
}
 
Example 28
Project: MobTotems   File: SpiderLogic.java   View source code 6 votes vote down vote up
@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);
                }
            }
        }
    }
}
 
Example 29
Project: NausicaaMod   File: EntityRobot.java   View source code 6 votes vote down vote up
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));
}
 
Example 30
Project: projectzulu1.7.10-pre-1.3a   File: EntityBear.java   View source code 6 votes vote down vote up
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));
}
 
Example 31
Project: projectzulu1.7.10-pre-1.3a   File: EntityTreeEnt.java   View source code 6 votes vote down vote up
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));
}
 
Example 32
Project: N-API   File: EntityRegistry.java   View source code 6 votes vote down vote up
/**
 * 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();
	}
}
 
Example 33
Project: RoboWarsInvasion   File: EntityBotShoot.java   View source code 6 votes vote down vote up
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));


}
 
Example 34
Project: ZeldaSwordSkills   File: EntityNpcBase.java   View source code 6 votes vote down vote up
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));
}
 
Example 35
Project: RuneCraftery   File: EntityVillager.java   View source code 6 votes vote down vote up
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_);
}
 
Example 36
Project: RuneCraftery   File: EntityIronGolem.java   View source code 6 votes vote down vote up
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));
}
 
Example 37
Project: The-Derpy-Shiz-Mod   File: WuerfeliumSword.java   View source code 6 votes vote down vote up
@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);
	}
}
 
Example 38
Project: projectzulu1.7.10   File: EntityTreeEnt.java   View source code 6 votes vote down vote up
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));
}
 
Example 39
Project: Decaying-World   File: EntityFooDog.java   View source code 6 votes vote down vote up
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);
}
 
Example 40
Project: Decaying-World   File: EntityTreant.java   View source code 6 votes vote down vote up
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));
}