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

项目:CustomAI    文件:CustomAIHelper.java   
public static void applyLists(Entity entity, List<EntityAITaskEntry> tasks, List<EntityAITaskEntry> targetTasks)
{
    if(hasEntityAI(entity))
    {
        clearExecutingTasks(entity);
        clearExecutingTargetTasks(entity);
        getTasksList(entity).clear();
        getTargetTasksList(entity).clear();
        getTargetTasksList(entity).addAll(targetTasks);
        getTasksList(entity).addAll(tasks);

        for(EntityAITaskEntry entry : tasks)
        {
            if(entry != null && entry.action != null)
            {
                setOwner(entry.action, entity);
                if(entry.action instanceof EntityAIDoorInteract)
                {
                    ((EntityLiving)entity).getNavigator().setEnterDoors(true);
                    ((EntityLiving)entity).getNavigator().setBreakDoors(true);
                }
            }
        }
    }
}