Java 类net.minecraft.entity.ai.EntityAITasks 实例源码

项目:DecompiledMinecraft    文件:EntityLiving.java   
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }
}
项目:DecompiledMinecraft    文件:EntityLiving.java   
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }
}
项目:BaseClient    文件:EntityLiving.java   
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }

    UUID uuid = this.getUniqueID();
    long j = uuid.getLeastSignificantBits();
    this.randomMobsId = (int)(j & 2147483647L);
}
项目:BaseClient    文件:EntityLiving.java   
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }

    UUID uuid = this.getUniqueID();
    long j = uuid.getLeastSignificantBits();
    this.randomMobsId = (int)(j & 2147483647L);
}
项目:Backmemed    文件:EntityLiving.java   
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = this.createBodyHelper();
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);
    Arrays.fill(this.inventoryArmorDropChances, 0.085F);
    Arrays.fill(this.inventoryHandsDropChances, 0.085F);

    if (worldIn != null && !worldIn.isRemote)
    {
        this.initEntityAI();
    }

    UUID uuid = this.getUniqueID();
    long i = uuid.getLeastSignificantBits();
    this.randomMobsId = (int)(i & 2147483647L);
}
项目:CustomWorldGen    文件:EntityLiving.java   
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = this.createBodyHelper();
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);
    Arrays.fill(this.inventoryArmorDropChances, 0.085F);
    Arrays.fill(this.inventoryHandsDropChances, 0.085F);

    if (worldIn != null && !worldIn.isRemote)
    {
        this.initEntityAI();
    }
}
项目:UHC-Reloaded    文件:EasierSkeleton.java   
@SubscribeEvent
public void onSkeletonUpdate(LivingEvent.LivingUpdateEvent event) {
    if (!(event.getEntityLiving() instanceof EntitySkeleton)) {
        return;
    }
    EntitySkeleton skeleton = (EntitySkeleton) event.getEntityLiving();
    EntityAITasks tasks = skeleton.tasks;
    boolean containsOld = false;
    Iterator<EntityAITasks.EntityAITaskEntry> itr = tasks.taskEntries.iterator();
    while (itr.hasNext()) {
        EntityAITasks.EntityAITaskEntry entry = itr.next();
        if (entry.action instanceof EntityAIAttackRangedBow) {
            itr.remove();
        }
        if (entry.action instanceof EntityAIAttackRanged) {
            containsOld = true;
        }
    }
    if (!containsOld) {
        tasks.addTask(4, new EntityAIAttackRanged(skeleton, 1.0D, 20, 15.0F));
    }
}
项目:Resilience-Client-Source    文件:EntityLiving.java   
public EntityLiving(World par1World)
{
    super(par1World);
    this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
    this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = new PathNavigate(this, par1World);
    this.senses = new EntitySenses(this);

    for (int var2 = 0; var2 < this.equipmentDropChances.length; ++var2)
    {
        this.equipmentDropChances[var2] = 0.085F;
    }
}
项目:enderutilities    文件:EntityUtils.java   
/**
 * Removes the (last found) dummy blocker AI task, if any
 * @param tasks
 */
public static void removeDummyAIBlockerTask(EntityAITasks tasks)
{
    EntityAIBase task = null;

    for (EntityAITaskEntry taskEntry : tasks.taskEntries)
    {
        if (taskEntry.action instanceof EntityAIDummyBlockerTask)
        {
            task = taskEntry.action;
        }

        // Restore the default mutex bits.
        // TODO: If modded mob tasks use this bit, then we should store the original value so we can restore it.
        if (taskEntry.action instanceof EntityAIFindEntityNearestPlayer)
        {
            taskEntry.action.setMutexBits(taskEntry.action.getMutexBits() & 0x7F);
        }
    }

    if (task != null)
    {
        tasks.removeTask(task);
    }
}
项目:ExpandedRailsMod    文件:EntityLiving.java   
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = this.createBodyHelper();
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);
    Arrays.fill(this.inventoryArmorDropChances, 0.085F);
    Arrays.fill(this.inventoryHandsDropChances, 0.085F);

    if (worldIn != null && !worldIn.isRemote)
    {
        this.initEntityAI();
    }
}
项目:Cauldron    文件:EntityLiving.java   
public EntityLiving(World p_i1595_1_)
{
    super(p_i1595_1_);
    this.tasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null);
    this.targetTasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = new PathNavigate(this, p_i1595_1_);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }
}
项目:Cauldron    文件:EntityLiving.java   
public EntityLiving(World p_i1595_1_)
{
    super(p_i1595_1_);
    this.tasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null);
    this.targetTasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = new PathNavigate(this, p_i1595_1_);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }
}
项目:RideableCows    文件:CommonProxy.java   
@SubscribeEvent
public void spawnEntity(EntityJoinWorldEvent event) {
    if (event.entity instanceof EntityCow) {
        EntityCow cow = (EntityCow) event.entity;
        cow.tasks.addTask(getPriorityOfTask(cow, EntityAITempt.class), new EntityAITempt(cow, 1.2D, RideableCows.wheat_on_a_stick, false));

        int controlPriority = getPriorityOfTask(cow, EntityAIMate.class);
        for (Object obj : cow.tasks.taskEntries) {
            EntityAITasks.EntityAITaskEntry taskEntry = (EntityAITasks.EntityAITaskEntry) obj;
            if (taskEntry.priority >= controlPriority) ++taskEntry.priority;
        }
        cow.tasks.addTask(controlPriority, new EntityAICowControlledByPlayer(cow, 0.45F));
    } else if (event.entity instanceof EntitySheep) {
        EntitySheep sheep = (EntitySheep) event.entity;
        sheep.tasks.addTask(getPriorityOfTask(sheep, EntityAITempt.class), new EntityAITempt(sheep, 1.1D, RideableCows.wheat_on_a_stick, false));
    }
}
项目:RuneCraftery    文件:EntityLiving.java   
public EntityLiving(World p_i1595_1_) {
   super(p_i1595_1_);
   this.field_70714_bg = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.field_72984_F != null?p_i1595_1_.field_72984_F:null);
   this.field_70715_bh = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.field_72984_F != null?p_i1595_1_.field_72984_F:null);
   this.field_70749_g = new EntityLookHelper(this);
   this.field_70765_h = new EntityMoveHelper(this);
   this.field_70767_i = new EntityJumpHelper(this);
   this.field_70762_j = new EntityBodyHelper(this);
   this.field_70699_by = new PathNavigate(this, p_i1595_1_);
   this.field_70723_bA = new EntitySenses(this);

   for(int var2 = 0; var2 < this.field_82174_bp.length; ++var2) {
      this.field_82174_bp[var2] = 0.085F;
   }

}
项目:RuneCraftery    文件:EntityLiving.java   
public EntityLiving(World par1World)
{
    super(par1World);
    this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
    this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = new PathNavigate(this, par1World);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }
}
项目:EnderZoo    文件:EntityUtil.java   
public static void cancelCurrentTasks(EntityLiving ent) {
  Iterator<EntityAITaskEntry> iterator = ent.tasks.taskEntries.iterator();
  List<EntityAITasks.EntityAITaskEntry> currentTasks = new ArrayList<EntityAITasks.EntityAITaskEntry>();
  while (iterator.hasNext()) {
    EntityAITaskEntry entityaitaskentry = iterator.next();
    if (entityaitaskentry != null) {
      currentTasks.add(entityaitaskentry);
    }
  }
  // Only available way to stop current execution is to remove all current
  // tasks, then re-add them
  for (EntityAITaskEntry task : currentTasks) {
    ent.tasks.removeTask(task.action);
    ent.tasks.addTask(task.priority, task.action);
  }
  ent.getNavigator().clearPathEntity();
}
项目:BetterNutritionMod    文件:EntityLiving.java   
public EntityLiving(World par1World)
{
    super(par1World);
    this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
    this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = new PathNavigate(this, par1World);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }
}
项目:EnderIO    文件:AIAttractionHandler.java   
private void cancelCurrentTasks(EntityLiving ent) {
  Iterator<EntityAITaskEntry> iterator = ent.tasks.taskEntries.iterator();

  List<EntityAITasks.EntityAITaskEntry> currentTasks = new ArrayList<EntityAITasks.EntityAITaskEntry>();
  while (iterator.hasNext()) {
    EntityAITaskEntry entityaitaskentry = iterator.next();
    if (entityaitaskentry != null) {
      currentTasks.add(entityaitaskentry);
    }
  }
  // Only available way to stop current execution is to remove all current
  // tasks, then re-add them
  for (EntityAITaskEntry task : currentTasks) {
    ent.tasks.removeTask(task.action);
    ent.tasks.addTask(task.priority, task.action);
  }
}
项目:pnc-repressurized    文件:HackableGhast.java   
@Override
public void onHackFinished(Entity entity, EntityPlayer player) {
    EntityAITasks tasks = ((EntityLiving) entity).tasks;
    for (EntityAITasks.EntityAITaskEntry task : tasks.taskEntries) {
        if (Reflections.ghast_aiFireballAttack.isAssignableFrom(task.action.getClass())) {
            tasks.removeTask(task.action);
            break;
        }
    }
}
项目:pnc-repressurized    文件:HackableBlaze.java   
@Override
public void onHackFinished(Entity entity, EntityPlayer player) {
    EntityAITasks tasks = ((EntityLiving) entity).tasks;
    for (EntityAITasks.EntityAITaskEntry task : tasks.taskEntries) {
        if (Reflections.blaze_aiFireballAttack.isAssignableFrom(task.action.getClass())) {
            tasks.removeTask(task.action);
            break;
        }
    }
}
项目:Possessed    文件:ServerEventHandler.java   
@SubscribeEvent
public void onLivingSetTarget(LivingSetAttackTargetEvent event) {
    if (event.getTarget() instanceof EntityPlayer && event.getEntityLiving() instanceof EntityLiving) {
        EntityPlayer player = (EntityPlayer) event.getTarget();
        PossessivePlayer possessivePlayer = PossessHandler.get(player);
        if (possessivePlayer != null) {
            EntityLiving entity = (EntityLiving) event.getEntityLiving();
            boolean cancelled = true;
            for (EntityAITasks.EntityAITaskEntry task : entity.targetTasks.taskEntries) {
                if (task.action instanceof EntityAINearestAttackableTarget) {
                    try {
                        Class<? extends EntityLivingBase> target = (Class<? extends EntityLivingBase>) ReflectionHandler.TARGET_CLASS.get(task.action);
                        if (target.isAssignableFrom(possessivePlayer.getPossessing().getClass())) {
                            cancelled = false;
                            break;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
            if (cancelled) {
                entity.setAttackTarget(null);
            }
        }
    }
}
项目:ShearMadness    文件:CommonForgeEventProxy.java   
@SubscribeEvent
public void onCommonEntityJoinWorldEvent(EntityJoinWorldEvent event)
{
    final Entity entity = event.getEntity();
    if (entity.hasCapability(Capability.CHISELED_SHEEP, null))
    {
        final EntityLiving livingEntity = (EntityLiving) event.getEntity();
        final EntityAITasks tasks = livingEntity.tasks;
        tasks.addTask(0, new SheepBehaviourAI(livingEntity));
    }
}
项目:Coding    文件:EntityCreeperDragon.java   
/**
     * Like actual Ocelots and Cats, the dragon will scare away Creepers.
     *
     */
    @SuppressWarnings("unchecked")
    public void checkForCreepers() {
        lastCheckTime--;
        if (lastCheckTime <= 0) {
            lastCheckTime = 30;
            List<EntityCreeper> creepers = this.worldObj.getEntitiesWithinAABB(EntityCreeper.class,
                    AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ,
                            this.posX + 1.0D, this.posY + 1.0D,
                            this.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));

            for (EntityCreeper creeper : creepers) {
                boolean set = true;
                EntityAIAvoidDragon task = new EntityAIAvoidDragon(creeper, EntityCreeperDragon.class, 14.0F, 1.0, 1.3);

                for (Object entry : creeper.tasks.taskEntries) {
                    if (((EntityAITasks.EntityAITaskEntry) entry).action instanceof EntityAIAvoidDragon) {
                        set = false;
                        break;
                    }
                }

                if (set) {
//                  LogHelper.info("Found creeper who doesn't know to fear the dragon :-)");
                    creeper.tasks.addTask(3, task);
                }
            }
        }
    }
项目:Gadomancy    文件:TileAIShutdown.java   
public AffectedEntity(UUID eUUID,
                      List<EntityAITasks.EntityAITaskEntry> tasks,
                      List<EntityAITasks.EntityAITaskEntry> targetTasks) {
    this.eUUID = eUUID;
    this.tasks = tasks;
    this.targetTasks = targetTasks;
}
项目:Gadomancy    文件:EntityAITasksWrapper.java   
public EntityAITasksWrapper(EntityGolemBase golem, EntityAITasks tasks, boolean scheduleUpdate) {
    super(tasks.theProfiler);

    this.golem = golem;
    this.original = tasks;

    this.taskEntries = new WrapperList(original.taskEntries);
    this.original.taskEntries = this.taskEntries;

    this.scheduleUpdate = scheduleUpdate;
}
项目:RidiculousWorld    文件:EntityPeep.java   
public EntityPeep(World world){
    super(world);
    this.timeUntilNextEasterEgg = this.rand.nextInt(6000) + 6000;
    EntityAIBase tempt = null;
    for(Object thingy : tasks.taskEntries){
        EntityAITasks.EntityAITaskEntry ai = (EntityAITasks.EntityAITaskEntry)thingy;
        if(ai.action instanceof EntityAITempt) {
            tempt = ai.action;
            break;
        }
    }
    if(tempt !=null)
        this.tasks.removeTask(tempt);
    this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.sugar, false));
}
项目:CustomAI    文件:CustomAIHelper.java   
private static void clearExecutingTargetTasks(Entity entity)
{
    if(hasEntityAI(entity))
    {
        EntityLiving living = (EntityLiving)entity;
        EntityAITasks targetTasks = living.tasks;
        ((List<?>)ObfuscationReflectionHelper.getPrivateValue(EntityAITasks.class, targetTasks, 2)).clear();
    }
}
项目:CustomAI    文件:CustomAIHelper.java   
private static void clearExecutingTasks(Entity entity)
{
    if(hasEntityAI(entity))
    {
        EntityLiving living = (EntityLiving)entity;
        EntityAITasks tasks = living.tasks;
        ((List<?>)ObfuscationReflectionHelper.getPrivateValue(EntityAITasks.class, tasks, 2)).clear();
    }
}
项目:AdventureBackpack2    文件:GeneralEventHandler.java   
@SubscribeEvent
public void makeHorsesFollowOwner(EntityJoinWorldEvent event)
{
    if(!ConfigHandler.BACKPACK_ABILITIES)return;
    if(event.entity instanceof EntityHorse)
    {

        EntityHorse horse = ((EntityHorse)event.entity);
        if(!horse.isDead && horse.isTame() && horse.hasCustomNameTag())
        {
            String ownerUUIDstring = horse.func_152119_ch();
            if (ownerUUIDstring != null && !ownerUUIDstring.isEmpty())
            {
                boolean set = true;
                if(horse.worldObj.func_152378_a(UUID.fromString(ownerUUIDstring)) != null)
                {
                    for (Object entry : horse.tasks.taskEntries)
                    {
                        if (((EntityAITasks.EntityAITaskEntry) entry).action instanceof EntityAIHorseFollowOwner)
                        {
                            set = false;
                        }
                    }
                }
                if(set)
                {
                    horse.tasks.addTask(4, new EntityAIHorseFollowOwner(horse, 1.5d, 2.0f, 20.0f));

                    if (horse.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.followRange) != null)
                    {
                        horse.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
                    }
                }
            }
        }
    }
}
项目:AdventureBackpack2    文件:BackpackAbilities.java   
/**
 * Like actual Ocelots and Cats, the Ocelot Backpack will scare the hell out of Creepers, so they won't creep on you
 * while you're busy doing something else, paying no attention whatsoever at your surroundings like a mindless chicken.
 *
 * @param player
 * @param world
 * @param backpack
 */
@SuppressWarnings("unchecked")
public void itemOcelot(EntityPlayer player, World world, ItemStack backpack)
{
    //lastTime in this backpack is in Ticks.
    InventoryBackpack inv = new InventoryBackpack(backpack);
    int lastCheckTime = inv.getLastTime() - 1;
    if (lastCheckTime <= 0)
    {
        lastCheckTime = 20;
        List<EntityCreeper> creepers = player.worldObj.getEntitiesWithinAABB(
                EntityCreeper.class,
                AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ,
                        player.posX + 1.0D, player.posY + 1.0D,
                        player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));

        for (EntityCreeper creeper : creepers)
        {
            boolean set = true;
            EntityAIAvoidPlayerWithBackpack task = new EntityAIAvoidPlayerWithBackpack(creeper, EntityPlayer.class, 10.0F, 1.0, 1.3, "Ocelot");

            for (Object entry : creeper.tasks.taskEntries)
            {
                if (((EntityAITasks.EntityAITaskEntry) entry).action instanceof EntityAIAvoidPlayerWithBackpack)
                {
                    set = false;
                    break;
                }
            }

            if (set)
            {
                //System.out.println("Found creeper who doesn't know to fear the backpack, making it a pussy now");
                creeper.tasks.addTask(3, task);
            }
        }
    }
    inv.setLastTime(lastCheckTime);
    inv.markDirty();
}
项目:enderutilities    文件:EntityUtils.java   
/**
 * Removes all AI tasks from the given EntityAITasks object
 * @param tasks the EntityAITasks object to remove the tasks from
 * @return true if at least some tasks were removed
 */
public static boolean removeAllAITasks(EntityAITasks tasks)
{
    List<EntityAITaskEntry> taskList = new ArrayList<EntityAITaskEntry>(tasks.taskEntries);

    for (EntityAITaskEntry taskEntry : taskList)
    {
        tasks.removeTask(taskEntry.action);
    }

    return taskList.isEmpty() == false;
}
项目:CliffiesDecor    文件:EntityDude.java   
public EntityDude(World world)
{
        super(world);
        System.out.println("Reporting for duty!");
        this.tasks = new EntityAITasks(world != null && world.theProfiler != null ? world.theProfiler : null);
        this.targetTasks = new EntityAITasks(world != null && world.theProfiler != null ? world.theProfiler : null);
        this.tasks.addTask(1, new EntityAILookIdle(this));
        this.tasks.addTask(1, new EntityAISwimming(this));
}
项目:CliffiesDecor    文件:EntityDude.java   
public EntityDude(World world, int color, int bat)
{
    super(world);
    this.setColor(color);
    this.setBatInt(bat);
    this.colorInt=color;
    this.battalionID=bat;
    this.tasks = new EntityAITasks(world != null && world.theProfiler != null ? world.theProfiler : null);
    this.targetTasks = new EntityAITasks(world != null && world.theProfiler != null ? world.theProfiler : null);
}
项目:N-API    文件:EventEntityLivingInit.java   
public EventEntityLivingInit(EntityLiving entity, World world, EntityAITasks tasks, EntityAITasks targetTasks, EntityLookHelper lookHelper, EntityMoveHelper moveHelper, EntityJumpHelper jumpHelper, EntityBodyHelper bodyHelper, PathNavigate navigator, EntitySenses senses)
{
    this.entity = entity;
    this.world = world;
    this.tasks = tasks;
    this.targetTasks = targetTasks;
    this.lookHelper = lookHelper;
    this.jumpHelper = jumpHelper;
    this.moveHelper = moveHelper;
    this.bodyHelper = bodyHelper;
    this.navigator = navigator;
    this.senses = senses;
}
项目:RideableCows    文件:CommonProxy.java   
private boolean addTask(EntityCow cow, int priority, EntityAIBase action) {
    for (Object obj : cow.tasks.taskEntries) {
        EntityAITasks.EntityAITaskEntry taskEntry = (EntityAITasks.EntityAITaskEntry) obj;
        if (action.getClass().isInstance(taskEntry.action)) {
            return false;
        }
    }
    cow.tasks.addTask(priority, action);
    return true;
}
项目:RideableCows    文件:CommonProxy.java   
private int getPriorityOfTask(EntityLiving living, Class<? extends EntityAIBase> clazz) {
    for (Object obj : living.tasks.taskEntries) {
        EntityAITasks.EntityAITaskEntry taskEntry = (EntityAITasks.EntityAITaskEntry) obj;
        if (clazz.isInstance(taskEntry.action)) {
            return taskEntry.priority;
        }
    }
    return -1;
}
项目:RideableCows    文件:RideableCows.java   
public static EntityAIControlledByPlayer getAIControlledByPlayer(EntityCow cow) {
    for (Object obj : cow.tasks.taskEntries) {
        EntityAITasks.EntityAITaskEntry taskEntry = (EntityAITasks.EntityAITaskEntry) obj;
        if (taskEntry.action instanceof EntityAIControlledByPlayer)
            return (EntityAIControlledByPlayer) taskEntry.action;
    }
    return null;
}
项目:HardModeTweaks    文件:AITweaksManager.java   
private void replaceAIPanicTask(EntityLiving entity) {
    EntityAITasks.EntityAITaskEntry panicTask = null;
    for (Object taskEntryObj : entity.tasks.taskEntries) {
        EntityAITasks.EntityAITaskEntry taskEntry = (EntityAITasks.EntityAITaskEntry) taskEntryObj;
        if (taskEntry.action instanceof EntityAIPanic) {
            panicTask = taskEntry;
        }
    }
    if (panicTask != null) {
        entity.tasks.removeTask(panicTask.action);
        entity.tasks.addTask(panicTask.priority, new EntityAIPanicAway(
                (EntityCreature) entity, 2.5f));
    }
}
项目:pnc-repressurized    文件:EntityDrone.java   
@Override
public EntityAITasks getTargetAI() {
    return targetTasks;
}
项目:pnc-repressurized    文件:TileEntityProgrammableController.java   
@Override
public EntityAITasks getTargetAI() {
    return null;
}