@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); } })); }
public void setRabbitType(int rabbitTypeId) { if (rabbitTypeId == 99) { this.tasks.removeTask(this.aiAvoidWolves); this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, true)); if (!this.hasCustomName()) { this.setCustomNameTag(StatCollector.translateToLocal("entity.KillerBunny.name")); } } this.dataWatcher.updateObject(18, Byte.valueOf((byte)rabbitTypeId)); }
public EntitySkeleton(World worldIn) { super(worldIn); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIRestrictSun(this)); this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D)); this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityWolf.class, 6.0F, 1.0D, 1.2D)); this.tasks.addTask(4, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true)); if (worldIn != null && !worldIn.isRemote) { this.setCombatTask(); } }
public EntityEnderman(World worldIn) { super(worldIn); this.setSize(0.6F, 2.9F); this.stepHeight = 1.0F; this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.tasks.addTask(10, new EntityEnderman.AIPlaceBlock(this)); this.tasks.addTask(11, new EntityEnderman.AITakeBlock(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(2, new EntityEnderman.AIFindPlayer(this)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityEndermite.class, 10, true, false, new Predicate<EntityEndermite>() { public boolean apply(EntityEndermite p_apply_1_) { return p_apply_1_.isSpawnedByPlayer(); } })); }
public EntityGuardian(World worldIn) { super(worldIn); this.experienceValue = 10; this.setSize(0.85F, 0.85F); this.tasks.addTask(4, new EntityGuardian.AIGuardianAttack(this)); EntityAIMoveTowardsRestriction entityaimovetowardsrestriction; this.tasks.addTask(5, entityaimovetowardsrestriction = new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(7, this.wander = new EntityAIWander(this, 1.0D, 80)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityGuardian.class, 12.0F, 0.01F)); this.tasks.addTask(9, new EntityAILookIdle(this)); this.wander.setMutexBits(3); entityaimovetowardsrestriction.setMutexBits(3); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityLivingBase.class, 10, true, false, new EntityGuardian.GuardianTargetSelector(this))); this.moveHelper = new EntityGuardian.GuardianMoveHelper(this); this.field_175484_c = this.field_175482_b = this.rand.nextFloat(); }
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; }
public void setRabbitType(int rabbitTypeId) { if (rabbitTypeId == 99) { this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(8.0D); this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, true)); if (!this.hasCustomName()) { this.setCustomNameTag(I18n.translateToLocal("entity.KillerBunny.name")); } } this.dataManager.set(RABBIT_TYPE, Integer.valueOf(rabbitTypeId)); }
protected void initEntityAI() { this.aiSit = new EntityAISit(this); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityWolf.AIAvoidEntity(this, EntityLlama.class, 24.0F, 1.5D, 1.5D)); this.tasks.addTask(4, new EntityAILeapAtTarget(this, 0.4F)); this.tasks.addTask(5, new EntityAIAttackMelee(this, 1.0D, true)); this.tasks.addTask(6, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); this.tasks.addTask(7, new EntityAIMate(this, 1.0D)); this.tasks.addTask(8, new EntityAIWanderAvoidWater(this, 1.0D)); this.tasks.addTask(9, new EntityAIBeg(this, 8.0F)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(10, 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, new Class[0])); this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate<Entity>() { public boolean apply(@Nullable Entity p_apply_1_) { return p_apply_1_ instanceof EntitySheep || p_apply_1_ instanceof EntityRabbit; } })); this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, AbstractSkeleton.class, false)); }
protected void initEntityAI() { super.initEntityAI(); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityEvoker.AICastingSpell()); this.tasks.addTask(2, new EntityAIAvoidEntity(this, EntityPlayer.class, 8.0F, 0.6D, 1.0D)); this.tasks.addTask(4, new EntityEvoker.AISummonSpell()); this.tasks.addTask(5, new EntityEvoker.AIAttackSpell()); this.tasks.addTask(6, new EntityEvoker.AIWololoSpell()); this.tasks.addTask(8, new EntityAIWander(this, 0.6D)); 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.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] {EntityEvoker.class})); this.targetTasks.addTask(2, (new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)).func_190882_b(300)); this.targetTasks.addTask(3, (new EntityAINearestAttackableTarget(this, EntityVillager.class, false)).func_190882_b(300)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, false)); }
protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWanderAvoidWater(this, 1.0D, 0.0F)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.tasks.addTask(10, new EntityEnderman.AIPlaceBlock(this)); this.tasks.addTask(11, new EntityEnderman.AITakeBlock(this)); this.targetTasks.addTask(1, new EntityEnderman.AIFindPlayer(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityEndermite.class, 10, true, false, new Predicate<EntityEndermite>() { public boolean apply(@Nullable EntityEndermite p_apply_1_) { return p_apply_1_.isSpawnedByPlayer(); } })); }
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 EntityAIWanderAvoidWater(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); } })); }
@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)); } } }
protected void initEntityAI() { this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(4, new AIAttack(this)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class,3, false,false,new Predicate<EntityLivingBase>(){ @Override public boolean apply(EntityLivingBase input) { // TODO Auto-generated method stub return (input instanceof EntityTF2Character || input instanceof EntityPlayer) && getDistanceSqToEntity(input)<600; } })); }
@Override protected void initEntityAI() { this.tasks.addTask(5, new AIRandomFly(this)); this.tasks.addTask(7, new AILookAround(this)); this.tasks.addTask(7, new AIFireballAttack(this)); this.targetTasks.taskEntries.clear(); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class, 0,true, false, new Predicate<EntityLivingBase>() { @Override public boolean apply(EntityLivingBase input) { // TODO Auto-generated method stub return input instanceof EntityPlayer || input instanceof EntityTF2Character; } })); this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, false)); }
@Override public void draw(WeaponsCapability weaponsCapability, ItemStack stack, final EntityLivingBase living, World world) { super.draw(weaponsCapability, stack, living, world); if (!world.isRemote) { weaponsCapability.controlledSentry = null; List<EntitySentry> list = world.getEntitiesWithinAABB(EntitySentry.class, living.getEntityBoundingBox().grow(128, 128, 128), new Predicate<EntitySentry>() { @Override public boolean apply(EntitySentry input) { // TODO Auto-generated method stub return input.getOwner() == living && !input.isDisabled(); } }); Collections.sort(list, new EntityAINearestAttackableTarget.Sorter(living)); if (!list.isEmpty()) { list.get(0).setControlled(true); weaponsCapability.controlledSentry = list.get(0); } } }
protected void initEntityAI() { this.aiSit = new EntityAISit(this); 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 EntityAIAttackMelee(this, 1.0D, true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.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 EntityAIBeg(this, 8.0F)); this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.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, new Class[0])); this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate<Entity>() { public boolean apply(@Nullable Entity p_apply_1_) { return p_apply_1_ instanceof EntitySheep || p_apply_1_ instanceof EntityRabbit; } })); this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, false)); }
protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.tasks.addTask(10, new EntityEnderman.AIPlaceBlock(this)); this.tasks.addTask(11, new EntityEnderman.AITakeBlock(this)); this.targetTasks.addTask(1, new EntityEnderman.AIFindPlayer(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityEndermite.class, 10, true, false, new Predicate<EntityEndermite>() { public boolean apply(@Nullable EntityEndermite p_apply_1_) { return p_apply_1_.isSpawnedByPlayer(); } })); }
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); } })); }
public EntityAIFindEntityNearestSkins(EntityLiving entityLivingIn) { this.taskOwner = entityLivingIn; if (entityLivingIn instanceof EntityCreature) { LOGGER.warn("Use NearestAttackableTargetGoal.class for PathfinderMob mobs!"); } this.predicate = p_apply_1_ -> { if (!(p_apply_1_ instanceof EntityArmyMember)) { return false; } else if (p_apply_1_.getIsInvulnerable()) { return false; } else { double maxTargetRange = EntityAIFindEntityNearestSkins.this.maxTargetRange(); return !((double) p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearestSkins.this.taskOwner) > maxTargetRange) && (EntityAITarget.isSuitableTarget(EntityAIFindEntityNearestSkins.this.taskOwner, (EntityLivingBase) p_apply_1_, false, true) && CAN_ATTACK_ARMY_MEMBER.test((EntityArmyMember) p_apply_1_)); } }; this.sorter = new EntityAINearestAttackableTarget.Sorter(entityLivingIn); }
public EntityWitchHunter(World par1World) { super(par1World); this.getNavigator().setAvoidsWater(true); this.getNavigator().setCanSwim(true); super.tasks.addTask(1, new EntityAISwimming(this)); super.tasks.addTask(5, new EntityAIWander(this, 1.0D)); super.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); super.tasks.addTask(6, new EntityAILookIdle(this)); super.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); super.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLivingBase.class, 0, false, true, this)); super.experienceValue = 5; this.targetPlayerName = ""; if(par1World != null && !par1World.isRemote) { this.setCombatTask(); } }
public EntityHornedHuntsman(World par1World) { super(par1World); this.setSize(1.4F, 3.2F); super.isImmuneToFire = true; this.getNavigator().setAvoidsWater(true); this.getNavigator().setCanSwim(true); super.tasks.addTask(1, new EntityAISwimming(this)); super.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, true)); super.tasks.addTask(3, new EntityAIMoveTowardsTarget(this, 1.0D, 48.0F)); super.tasks.addTask(4, new EntityAIArrowAttack(this, 1.0D, 20, 60, 30.0F)); super.tasks.addTask(5, new EntityAIWander(this, 1.0D)); super.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); super.tasks.addTask(7, new EntityAILookIdle(this)); super.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); super.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); super.experienceValue = 70; }
public EntityAINearestAttackableCivTarget(EntityToroNpc npc) { super(npc, false, false); this.taskOwner = npc; this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(npc); this.setMutexBits(1); this.targetEntitySelector = new Predicate<EntityPlayer>() { public boolean apply(@Nullable EntityPlayer target) { if (target == null) { return false; } if (!EntitySelectors.NOT_SPECTATING.apply(target)) { return false; } if (!isSuitableTarget(taskOwner, target, false, true)) { return false; } return shouldAttackPlayerBasedOnCivilization(target); } }; }
protected void initEntityAI() { areaAI = new EntityAIMoveIntoArea(this, 0.5D, 30); tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(2, new EntityAIAttackMelee(this, 0.6D, false)); tasks.addTask(4, areaAI); tasks.addTask(7, new EntityAIWander(this, 0.35D)); tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); tasks.addTask(8, new EntityAILookIdle(this)); targetTasks.addTask(2, new EntityAINearestAttackableCivTarget(this)); targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityMob>(this, EntityMob.class, 10, false, false, new Predicate<EntityMob>() { @Override public boolean apply(EntityMob target) { return !(target instanceof EntityCreeper); } })); }
public EntityGiaprey(World worldIn) { super(worldIn, 1, 1); this.setSize(1.5F, 1.8125F); setBaseHealth(11); setBaseAttack(2); setBaseSpeed(0.3); setBaseKnockback(0.1); this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f)); this.tasks.addTask( 4, new EntityAIAttackMeleeAndSpit(this, 1.0D, 200, 16.0f,4.0f, true)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true)); }