net.minecraft.entity.ai.EntityAITasks Java Examples

The following examples show how to use net.minecraft.entity.ai.EntityAITasks. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityUtils.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #2
Source File: EntityUtil.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
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();
}
 
Example #3
Source File: CraftRabbit.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setRabbitType(Type type) {
    EntityRabbit entity = getHandle();
    if (getRabbitType() == Type.THE_KILLER_BUNNY) {
        // Reset goals and target finders.
        World world = ((CraftWorld) this.getWorld()).getHandle();
        entity.tasks = new EntityAITasks(world != null && world.profiler != null ? world.profiler : null);
        entity.targetTasks = new EntityAITasks(world != null && world.profiler != null ? world.profiler : null);
        entity.initializePathFinderGoals();
    }

    entity.setRabbitType(CraftMagicMapping.toMagic(type));
}
 
Example #4
Source File: TileAIShutdown.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public AffectedEntity(UUID eUUID,
                      List<EntityAITasks.EntityAITaskEntry> tasks,
                      List<EntityAITasks.EntityAITaskEntry> targetTasks) {
    this.eUUID = eUUID;
    this.tasks = tasks;
    this.targetTasks = targetTasks;
}
 
Example #5
Source File: EntityAITasksWrapper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #6
Source File: EntityUtils.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #7
Source File: EntityDrone.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAITasks getTargetAI(){
    return targetTasks;
}
 
Example #8
Source File: TileEntityProgrammableController.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAITasks getTargetAI(){
    return null;
}
 
Example #9
Source File: IDrone.java    From PneumaticCraft with GNU General Public License v3.0 votes vote down vote up
public EntityAITasks getTargetAI();